Broken Saints: despite all the suffering they have had to go through, each of our "broken" heroes is healed in the end, the men by the power of Shandala's love, Shandala by the power of theirs, and the world is saved.
The two main characters in There she is!! go through a number of tribulations before they get to their happy ending.
In the interactive poem Today I Die, this is used as a metaphor for overcoming depression. The protagonist must swim with a boulder tied to her waist.
Ditto with Ruby Quest, where the characters have much bigger problems: Mutations, monstrous abominations, unspeakable evils from the beginning of time, and trying to escape from a mysterious facility where they have been trapped for over a year already, with several dozen failed escape attempts. The main characters get the happy ending they deserve, some of the others don't.
In addition, how the happy ending is earned in Ruby Quest is quite possibly one of the most literal and unintentional examples around (think of it as having been a point-and-click adventure game, except by virtue of being roleplayed by post on an Imageboard, it was very open-ended). Ruby and Tom come across a medical cabinet with a small lock, which the players have Tom bash open with the crowbar. Some tranquilizer is found inside, which they take in a syringe. A little later, they encounter, have a fight with, and eventually subdue with the tranquilizer a psychotic and suicidal Stitches. Immediately after, it is discovered that Stichesactually had the key they were supposed to open the medical cabinet with. Then, instead of killing him and being done with it, the players stuff him into a revival locker and leave him, but not before also slipping him a portrait with himself, Ruby, Tom, and all the other patients and staff in the facility before things went to hell. Cut to the endgame of the story. Ruby, Tom, and an also unintentionally-rescued Jay, have unlocked the escape hatch to the facility, but Ace is in close pursuit. Tom realizes that Ace will catch them if all three of them try to go up the hatch, as they won't be able to close it in time. Someone has to stay behind and delay Ace. After much wailing and gnashing from the players and cry of foul play, it is somehow painfully decided that Tom be the one to stay behind. Ruby and Jay make their way up the ladder, just as Ace appears in the doorway. Tom prepares himself for the inevitable outcome, but then...guess who? Stitches suddenly tackles Ace out of nowhere, and gives Tom enough time to scramble up the ladder and slam the hatch (and also causing quite a few players to fervently thank the "Deus ex Machina"). By a combination of breaking something they weren't supposed to and being incredibly merciful, the players literally earned their happy ending.
Which apparently was a bad thing, because it meant someone's pick for "designated casualty" failed to die horribly.
Summed up spectacularly with The Nostalgia Chick's review of Don Bluth's Thumbelina, where the despairing heroine is surprised to find her prince Cornelius alive and well - "Things are impossible! Things are... oh! Hi dead boyfriend! Thanks for coming along and proving my pessimism wrong and not making me work for that happy ending!"
Sir Ron Lionheart, in his Let's Play of Majora's Mask, went out of his way to set everything right, and we mean every last sidequest. It was a long haul, but it was worth it to see a dawn of a new day.
Counter Monkey: "The Last Ride of Tandem the Spoony." After making it through a horrendously difficult campaign against all odds, Tandem and the only other survivor find themselves with a ship that can cross dimensions, so they first go home to resurrect their friends, and then everyone was last seen sailing away to whatever adventures await them next.