I have a personal fondness for twist endings. Especially cruel ones. But they have to make sense with the context of the story, be adequately foreshadowed, and not destroy the entire point of the story. Here're two examples of what one should or should not do for twist endings, from my tumblr rant on Cruel Twist Endings (and what exactly is the line between it being a Diabolus Ex Machina and a good cruel twist ending).
A good cruel twist ending:
Bob, a hero, sets off on his journey to slay the greatest menace of the lands, Emperor Evulz. On his way, he meets a girl named Alice who joins him in his journey. He falls in love with her. Blinded by hatred for Evulz and love for Alice, Bob fails to notice that there is something wrong about Alice. Finally, in the dungeon, Bob slays the Emperor - and when he is celebrating, Alice betrays him and murders him, cackling evilly and taking over the Emperor’s seat. Turns out all along, she was trying to pit both of them against each other so that she can reap the spoils. Bob’s death was not only because of his carelessness, but because of how he’s been blinded by his emotions, resulting in his tunnel-vision and ultimate failure. Cruel Twist Ending.
One example would be The Witch's House.
Throughout the entire story, we were blind to the main character's clear faults and cruelty, dismissing it as another horror game gimmick. Then at the end - bam. Your main character was the villain all along. It was a beautiful ride.
A bad twist ending:
Bob, a hero, sets off on his journey to slay the greatest menace of the lands, Emperor Evulz. On his way, he meets a girl named Alice who joins him in his journey. He falls in love with her. Finally, in the dungeon, Bob slays the Emperor. Bob and Alice celebrate, and are married. Two days later, Bob gets knocked down by a truck. Cruel Twist Ending.
A prime example would be Mad Father.
Aya escapes the house. But then in the future she starts making dolls out of people too because she has her dad’s blood in her and thus ends up turning out just like daddy! It is ridiculous because it defeats the entire point of the game and all possible character development which Aya and Maria have gained. It was simply an attempt at making the game seem chilling, the way TWH did, but failed miserably. There was absolutely no foreshadowing that Aya would turn out like that. Throughout the game, she’s been growing stronger and more helpful, and less dependent on her parents. Which is good - and so does Maria, who learns how to live independently of the Doctor and his cruel actions. And then suddenly - WHAM FOR NO PARTICULAR REASON.