hmmm... I haven't done it overly much yet. It takes the truly skilled to pull it off. You need to balance the pain you are causing the character with happiness for that character. Or at least appear to have it balance.
An example where there was no balance is Harry Potter book 5. I've had a seriously hard time writing HP stuff since that book came out. It didn't suck, exactly... but I threw the book across the room 3 times when reading it, I got so frustrated. You don't want to do that to your readers.
An example of pulling it off is Mercedes Lackey's "Magic's Pawn". (in case you haven't read it, it is a Valdemar book and the main character is gay.) Something terrible happens and a main character dies and the emotional pain in this book is huge. But she pulls it off. It is one of my favorite books, despite the fact that I cry at the scene every time I read it.
Something I'm writing right now is an attempt to explore some of the more complex realities in life. We'll see where it goes.
Great question Comsie!