Surprisingly Happy Ending

"Celestia: Are you not happy that your quest is complete and you can return to your studies in Canterlot? Twilight: That's just it. Just when I learned how wonderful it is to have friends, I have to leave them. Celestia: Spike, take a note please. I, Princess Celestia, hereby decree that the unicorn Twilight Sparkle shall take on a new mission for Equestria. She must continue to study the magic of friendship; she must report to me her findings; from her new home in Ponyville!"

- My Little Pony Friendship Is Magic

Towards the end of a work, it seems like the ending coming up is going to be bittersweet if not a full-blown downer; but a sudden plot-twist comes around that yields a happier ending than one could have logically expected.

Note that, while the happy ending is logically a surprise to the characters, it might not be one for Genre Savvy viewers.

Anime and Manga

 * The Xenosaga anime (and the first game it's been adapted from) ends with KOS-MOS seemingly sacrificing herself to save Shion and the rest. Then, however, she comes back, battered but otherwise fine. It's still a Bittersweet Ending, since, but not the Downer Ending it could have been.
 * Tiger and Bunny managed to pull this trope twice in the final two epsiodes.
 * In Zero no Tsukaima, this happens at least twice:
 * In the second season of the anime, Saito  Cue Louise's Heroic BSOD when she realizes
 * In the third season, it appears the heroes have successfully escaped a Fate Worse Than Death... except that they've

Film
"Sultan: Well, am I Sultan or am I Sultan? From this day forth, the princess shall marry whomever she deems worthy."
 * In Two Brothers the two titular tigers have escaped back into the wild, but the two main human characters are afraid that the tigers will become man-eaters if they never learn to hunt animals. At the last minute, the two tigers reunite with one of parent, so now they have a tiger to learn hunting skills from.
 * Monsters, Inc. seems like it's about to have a Bittersweet Ending in the form of, but it turns out that.
 * In WALL-E, although EVE manages to repair and reactivate WALL-E, his memory and personality seemed to have disappeared for good... until EVE kisses him.
 * Disney's Aladdin. Under the laws of Agrabah, Princess Jasmine had to marry a prince. At the end of the movie Aladdin was no longer a prince so Jasmine couldn't marry him. But wait!


 * Lilo and Stitch. Just after Stitch saves Lilo, the Grand Councilwoman arrives to take him away. Even after Stitch shows signs of being reformed, the Councilwoman points out that the law is absolute. Then Lilo points out that she bought him at the shelter, and that taking him away would be stealing. The Councilwoman then declares that Stitch will serve the rest of his sentence on Earth, under the care of Lilo and her family.
 * Harold and Maude

Literature

 * In The Lion, the Witch and the Wardrobe, the White Witch has been defeated, but Edmund is mortally wounded and dying. Then Lucy remembers she has a magical cordial that has an unlimited supply of cure-all Healing Potion.
 * In the last book of The Roman Mysteries, Flavia is exiled form Italia and must leave behind the place where she has grown up all her life. However, at the last minute, her love interest shows up and says that he is going to go into exile with her, leaving behind a promising political career and faking his own death just to be with her.
 * The book The Saddest Little Robot appears to end with the eponymous robot's Heroic Sacrifice, complete with the words "The End". What follows is an additional chapter where Snoot comes back to life.
 * The Black Company - through the final tomes of the saga, the last characters that still remember the first book get killed off or simply die of old age. Croaker is once again the Company chronicler but he keeps lampshading how old he is. Then . To save the world they need to kill a sleeping Physical God but even if they succeed  . Their child, "Daughter of the Night" turns out   and as the ending approaches it looks more and more like the story will end with all the characters dying while the new Company marches on to forge its own destiny. Then   it might still be somewhat bittersweet but by the world's standards a shockingly happy ending.
 * One of the short stories in Alice Munro's Hateship, Friendship, Courtship, Loveship, Marriage is about a down-on-her-luck woman traveling to see a man she believes is in love with her when in fact he doesn't even know she exists and his love letters to her were all sent by a pair of teenage girls who didn't want her to be crushed by never receiving a reply from him. This can only lead to disappointment and heartbreak for the woman, right? Nope; the man turns out to be lonely and glad for the company and the woman decides that it would be best not to bring up the letters with him, and it ends with Babies Ever After and one of the girls in on the love letter plot wondering at how everything turned out all right in the end.

Live Action TV

 * The ending of Series Six of Doctor Who. Time is no longer going to unravel, but it happened at the expense of . Except that.

Music

 * In the original Peter and The Wolf the story ends by revealing that the duck that had been eaten was swallowed alive by the wolf, creating only vague possibility that the duck would be recovered. However, it also allows for the possibility that the duck would simply die a slow death inside the wolf, which is the interpretation that Weird Al Yankovic gave to it. Because of this, many adaptations add the wolf vomiting the still-alive duck back up at the ending.

Video Games

 * Super Mario Sunshine had FLUDD destroyed, while everything else about the plot reached its resolution. Then, in the final scene, the Toads present a repaired FLUDD.
 * In Lufia, it appears that the Hero.

Visual Novels
"Shirou: "I'm back." Saber: "Welcome home, Shirou.""
 * The Realta Nua Play Station 2 Port of Fate/stay night adds a "Last Episode" epilogue to the Fate Route's ending, where Saber returns to Camlann at the end of the Grail War. In that epilogue, Merlin explains that for Saber to be reunited with Shirou, two miracles must occur -- Saber has to wait endlessly while Shirou has to pursue her endlessly. In the end, they both fulfill the miracles and reunite in Avalon.

Western Animation

 * The ending of the two-part premiere of My Little Pony Friendship Is Magic. Protagonist Twilight Sparkle has completed her assignment in Ponyville and expects to return home, despondent about leaving her newfound friends in the process. As it is a series premiere, Genre Savvy viewers won't believe it for a moment...