Not Quite Saved Enough

So you spent the past 20 hours fighting your way past the forces of darkness, plumbing the depths of hell itself and personally handing the Big Bad's strongest minions their own asses, all to rescue the princess and see her home safely. The princess and the hero kiss, the king hands the hero his just reward, and he sets off, no doubt intending to walk off into the sunset. You can practically smell the credits about to roll...

...and then the enemy superweapon levels the castle, killing the princess and demolishing the surrounding town. You and the protagonist sit there, stunned: what the hell just happened?

As it turns out, the princess was Not Quite Saved Enough.

Sometimes, no matter what the heroes do, destiny (i.e. the writer) just has it in for some characters. Save the princess? You come back later and find out she's suffered a Fate Worse Than Death. Rescue the village? The Big Bad burns it later. Recover the legendary artifact? Too bad; there's a mole among the good guys and he smashes it right before the heroes have the chance to use it. This is a very specific and special flavor of Diabolus Ex Machina that only happens when after the protagonists think they've won, a prolonged Hope Spot capped off with a Shoot the Shaggy Dog moment.

Compare Pyrrhic Victory. Can rely on Cutscene Incompetence. If this applies to an entire setting as opposed to a single character, it becomes Happy Ending Override. See also All for Nothing and Yank the Dog's Chain.

Anime & Manga

 * Nia Teppelin from Tengen Toppa Gurren Lagann dies in the ending as a direct result of destroying the Anti-Spiral, even though Simon had spent the entire second half of the series trying to save her. A truly irritating example, since it destroys the entire Screw Destiny theme of the series.
 * In One Piece, Luffy goes to rescue from the World Government. He fights through the world's worst prison only to find he's at the Marine HQ. So he goes there, and manages to, with the aid of a massive army, rescue him just in the nick of time.

Comic Books

 * Hellblazer: John Constantine and a friend have come across a little village that's hoping to use a discontinued pagan festival to revive their economy. Unfortunately said festival causes people to become a twisted version of whatever they're dressed as and go completely Ax Crazy. John eventually discovers that loud punk music can stop the effects and has safely hidden his friend and some survivors in a nightclub. He goes to get help and then

Film

 * Perhaps the prototypal example is the original Night of the Living Dead. In a movie filled with groundbreaking departures from tradition, this trope was perhaps the most significant.
 * In the second Tales from the Crypt movie, Bordello of Blood, the hero Rafe rushes to save the female protagonist Katherine after she is captured by Lilith and taken to her to be fed on. At first it seems Rafe made it in time to stop Lilith from biting Katherine and focus her attention on him. But after Lilith is destroyed and the heroes cremate her remains, we find out that Lilith did indeed bite her - but on the leg rather then the neck - and had long since turned her. Which Rafe unfortunately finds out too late at the end of the film.
 * An ending taken straight from The Fearless Vampire Hunters, and also seen in both Count Yorga films.
 * Drag Me to Hell,
 * In The Ruins,
 * Das Boot has a particularly cruel example. Most of the film deals with the sheer terror faced by the men in a German U-Boat during World War II, including several points where they're nearly sunk by Allied depth charges.
 * In Play Dirty, another WWII movie, this one set in North Africa, the hero and The Lancer destroy a Nazi fuel depot the night before the Allies take the city it's in. They lay low in a nearby shack, and wait for the Allied forces to arrive, at which point

Literature

 * In the third book of the Tennis Shoe Adventure Series, Harry saves from being killed by one of Jacob's warriors. however   was still badly hurt, and dies of infection only hours later.
 * And while it doesn't quite stick, due to the nature of the series (time travel) the same happens to in a later book.
 * War for the Oaks: The Queen of the Unseelie Court has  kidnapped in order to pressure the Seelie Court into conceding to them. Eddi determines to save him, recruits allies, and mounts a successful rescue attempt...all for nothing, when   comes out of nowhere with a gun.

Live Action TV

 * A Real Life Writes the Plot example appeared in Monk: in the fifth season episode "Mr. Monk Gets A New Shrink", Adrian Monk's psychiatrist becomes a murderer's next target and he has to save him. During the sixth season, the actor who played Monk's psychiatrist passed away, and this was written into the story in the seventh season, explaining that Monk's psychiatrist himself passed away.
 * On Lost, Locke spends the episode "Further Instructions" saving Eko from a polar bear. Two episodes later, the smoke monster kills Eko.
 * Desmond uses his precognition to save Charlie's life but since You Can't Fight Fate Charlies is still going to die, just under different circumstances. Charlie is in a permanent state of Not Quite Saved Enough with Desmond having to save him from new lethal danger all the time/
 * Has happened a lot on Doctor Who. Several times, characters will be rescued by the Doctor and his companions, only to killed a bit later on when the writer thinks they've outlived their usefulness to the story and can't think of anything to do with them.
 * The new series 5 episode Vincent and The Doctor deserves a special mention. Admittedly it was a Foregone Conclusion as even in universe it is explicitly mention several times that Vincent van Gogh committed suicide. But it's still a little heartbreaking when Amy rushes to see if they saved him.
 * Happens in an episode of Buffy the Vampire Slayer. Buffy saves a girl predicted to die from becoming a demonic sacrifice, but (in an example of You Can't Fight Fate) the girl dies at the appointed time anyway from an unknown heart defect.
 * Supernatural does this a few times when the people Sam and Dean managed to save die shortly after the heroes leave.
 * The brothers save the people trapped in a police station by demons and even manage to save the people possessed by the demons. They even gain an important ally in a FBI agent who was pursuing them (thinking they were domestic terrorists.) After the brothers leave, the Big Bad shows up and kills everyone.
 * After leaving a town where the inhabitants have gone Axe Crazy due to a demonic plague, the brothers leave the two survivors they rescued. It turns out one of the survivors was actually demon possessed, and he quickly kills the other.
 * The episode of Star Trek: Deep Space Nine titled "The Sound of Her Voice" did this, where
 * On NCIS: Los Angeles
 * In Highlander the Series, Duncan MacLeod rescues his mortal girlfriend Tessa Noel from a renegade Watcher ... only for a random mugger to show up and gun her down on the street outside when she doesn't hand over her engagement ring fast enough.
 * On Deadliest Catch, Capt. Phil Harris suffered a massive stroke that should've killed him, but doctors were able to relieve pressure on his brain in time. He was recovering wonderfully, even regaining some feeling in his paralyzed side until he had a second fatal "episode". The few Hope Spots of people relaying good news are heartrending, especially since he died several months before the season premiered.

Mythology

 * Older Than Feudalism: Orpheus goes to the Underworld to recover his dead wife Eurydice. Hades agrees to allow Eurydice to return with him to Earth on one condition: he should walk in front of her and not look back until they both had reached the upper world. He set off with Eurydice following and in his anxiety as soon as he reached the upper world he turned to look at her, forgetting that both needed to be in the upper world, and she vanished for the second time.

Video Games

 * .hack: Aura, Mia and the entirety of The World R:1. The original four .hack games end with Kite having secured his place in legend as the "Azure Flame" by saving the MMORPG The World and all the AI in it, including Aura, the daughter The World's creator wished he had, from the malevolent digital sentience Morganna and her Eight Phases. Mia, the purple catgirl who turned out to be one of the Eight Phases, can also be restored at the end of the final game by plumbing the depths of a 100-floor bonus dungeon.
 * Then we flash forward to the .hack//G.U., where Jyotaro Amagi has single-handedly destroyed everything. The World R:1 is no more, its servers having been destroyed in a colossal fire after Amagi went berserk when his R.A. project failed, and Aura has faded away as a result. More frustratingly, the R.A. project required the data from the Eight Phases, and obtaining this data involved vivisecting Mia. That's right: they killed her off in backstory, after you had to go through all that trouble saving her. Sometimes .hack//G.U. feels like a colossal Take That at the entire fanbase.
 * Actually, Aura was already missing of her own choice before the R.A. Plan went into effect. In fact, R.A. stands for "Restore Aura". They tried to recreate the Morganna system under their control to recreate Aura without a second Twilight Incident.
 * Dead Rising has various levels of this depending on which ending you get. Ironically, the game's best ending causes this for everyone. All the survivors you've fought so hard to rescue are carted off and disposed of by the military to keep the dirty secret that's caused the Zombie Apocalypse under wraps. By the end, only protagonist Frank West and the former Big Bad's sister (post Heel Face Turn) are alive, and even then it's not obvious how they escape (or even if they both do; Frank West is the only confirmed survivor). In a specific example, the death toll includes your temporary boss Brad Garrison, who you have to save from the Big Bad (and gets turned into a zombie anyway).
 * It doesn't say the survivors are killed in Dead Rising. It's even hinted that they were told to keep quiet in return for safe passage.
 * Otis leaves a note for you after the military show up that says in the confusion, he managed to steal a helicopter and escape.
 * Brad is a particularly major example, though. After he gets shot, you have to find medical supplies to make sure he doesn't die from the wound. Then you get further on, and he ends up locked in an underground parking lot with an army of zombies.
 * In Call of Duty 4, one of the protagonists, a US Marine, rescues a downed helicopter pilot and gets and his squad evacuates the capital. However, the villain sets off a nuke in his own capital, not only killing destroying most of the US expeditionary force, but crashing the Blackhawk the Marine was on killing both the "rescued" helicopter pilot and the player, who is only able to stagger out of the wrecked chopper's exit ramp before collapsing and expiring.
 * Rhapsody: A Musical Adventure has the Frog Kingdom:
 * Super Robot Wars Original Generation, especially the 2.5/Gaiden. According to the OVA that it's based on, once Kyosuke saved Lamia from the Bartolls, all should be well. So they're free to chat leisurely, right? Then Juergen pops by and shot down Lamia, making everyone think she's dead and Kyosuke failed to save her. It then continues for the true save later in the Duminuss arc, though.
 * Castlevania: Lament of Innocence. Leon Belmont just saved his lover Sara Trantoul from the vampire Walter Bernhard. Just when Leon thought he could just put everything behind, he found out one nasty thing: Sara has been vampirized and is about to suffer Fate Worse Than Death. He's forced to use his Whip of Alchemy to put Sara out of misery, incidentally evolving it to the legendary Vampire Killer. Cue Leon's Roaring Rampage of Revenge. Oh, and the Vampire Killer has her soul sealed within it, for extra suckiness.
 * In Sam and Max: The Devil's Playhouse Episode 2: The Tomb of Sammun-Mak, Sameth and Maximus' rip-roaring 20's-style pulpy adventure leads them through numerous close encounters with spring-loaded scimitars, diabolical crushing traps, a villainous, gun-toting Santa Claus lookalike, mad priests of eldritch gods and an irate conductor: any one of these encounters can end in certain death for our two early 20th-century heroes,  Considering, however, that the chapter starts with present-day Sam and Max finding their skeletons in the same boiler room that their story ends in, it's a Foregone Conclusion.
 * Obs Cure 2 has Mei's efforts to track down and save  all come to naught when they're killed literally right before Mei can reach them. This is just the first of a series of Plotline Deaths that render the player's actions practically pointless, as only   survive all the way to the   end.
 * In Jade Empire, you get to save your village from bandits in the prologue with a bit of help from Master Li, but.
 * The Outcasts from Knights of the Old Republic that a Light Side Player Character saves? They get to their Promised Land, only to find it's a ruin. sure, it saves them from the bombing, but they're left to die a slow and horrible death by being picked off by rakghouls, disease, starvation, and toxic waste. But what do you expect from post-Dragon Age BioWare?
 * In Avernum 4, assassins magically ambush the king's adviser in his chamber in the party's presence. The unarmed NPC falls extremely easily in the ensuing battle, but with enough power and quick action it is possible to defeat the assassins before he is killed. He then collapses and dies anyway, from a poisoned wound.
 * Can happen of a sort in Persona4. If

Webcomics

 * In Homestuck, Doc Scratch tells the Handmaid that she's fated to serve as an agent of destruction for Lord English, but she wants no part of this. Andrew Hussie himself comes charging in to rescue her and to regain control of the narrative. Hussie effortlessly overpowers Scratch, and the Handmaid leaps out a window to make her getaway--and she is almost immediately recaptured by Lord English himself.

Western Animation

 * A rare, humorous version happens in the Rocko's Modern Life episode "Wallaby On Wheels", where the climax involves Rocko putting his jackhammer hobby to good use to save Heffer from falling into the O-Town Bottomless Pit. He ends up plugging the pit with a massive globe of the Earth, saving Heffer and winning the attention of the girl he'd been trying to woo the whole episode. Unfortunately, the globe cracks apart for no apparent reason, sending Heffer plummeting.
 * In the Titan Maximum season 1 finale Willy stops the time bomb  with Six Seconds Left, with Gibbs tied up. Unfortunately, while they were arguing with each other, Gibbs escaped and revealed that he prepared a remote detonator, and his plan succeeded.