->'''Erich:''' Have you noticed how we did really well at the start of the war and the Allies nearly lost, but now things seem to be going a lot better for them?\\
'''Hans:''' Yeah?\\
'''Erich:''' Well, have you ever seen a film?\\
'''Hans:''' ...what's your point?\\
'''Erich:''' Well, I've never seen a film where the good guys start off incredibly successfully, really nearly achieve their goals, then the baddies come back strongly but the good guys still eventually win; whereas I have seen a lot of films where the baddies nearly win at the beginning and then the good guys come back strongly and eventually win.
-->-- ''Series/ThatMitchellAndWebbLook'', in which two SS troopers [[HeelRealization start worrying that Nazi Germany might actually be the bad guys]]

All hope is lost! Soon the BigBad will achieve [[EvilPlan his/her goal]] of taking over/destroying the city/world/universe, and there's nothing the heroes can do to stop them! But then WHAM - something unexpected happens, and the tide turns in the heroes' favor, allowing them to overcome the villain and win.

This is what we call a Near Villain Victory, where the bad guys look like they're going to win only to get defeated at the last moment.

It is a given that in battles between the forces of good and evil, the heroes will win most of the time and the villains will be defeated in the end. So, the writers will come up with scenarios that stack the odds in the villains' favor and give them minor victories, thus raising tension by getting the audience to think that ''maybe'' this time the hero won't save the day.

Often, it's the very ''fact'' the villain is so close to victory that results in their downfall. Maybe they've got the heroes on the run, maybe they've got every right to think they're going to win or already have... then they get cocky. [[NothingCanStopUsNow Because they already declared victory, they come to think the hero is no longer a real threat to them]]. Sometimes, they might even ignore the hero to focus on putting the finishing touches to their plan or announce themselves the supreme EvilOverlord, confident they've got nothing to worry about. This gives the heroes the opening to make a big, crippling blow when the BigBad is least expecting it.

Note: There is in fact a very real and very specific word for this trope. That word is [[http://en.wikipedia.org/wiki/Eucatastrophe eucatastrophe]]. (It's also worthwhile to note [[Creator/JRRTolkien who invented this word]]. Though Creator/JRRTolkien's definition stresses that somehow things go good, not solely because a group of hard working Badass heroes are turning it around, but because of some intervention or action beyond the heroes' control - in effect, a miracle - that makes victory possible.)

When this trope gets subverted and the villain still wins anyway, you have a HopeSpot.

Compare YouCantThwartStageOne. Might overlap with DarkestHour. Often used to set up a plot about coming BackFromTheBrink when it occurs in video games. If it gets bad enough, then OnlyTheAuthorCanSaveThemNow. In video games, the InstantWinCondition can easily result in this trope. Contrast MeaninglessVillainVictory.



[[folder:Anime and Manga]]
* Occurs in the Cell Saga of ''Anime/DragonBallZ'', when BigBad Cell who was thought to have died when he self-destructed comes back thanks to his regeneration FromASingleCell and is now even STRONGER than Super Saiyan 2 Gohan. Cell launches a MASSIVE Kamehameha wave with the intent of blowing both the Z-Warriors and the earth away and it's all Gohan can do but hold him off in a BeamOWar struggle which he is slowly losing ground in (the anime, which thankfully was kept in ''Kai'', included the Z-Warriors helping out by firing energy blasts at Cell from behind. Though he manages to deflect them through pure energy alone). Then all of a sudden, Vegeta blasts Cell from behind distracting him long enough that Gohan can push both Kamehameha waves back at Cell, killing him off for good.
** At around the same time of Vegeta's attack, Goku (who recently [[HeroicSacrifice died to save the planet from Cell's self-destruction]]) appeared in spirit form to tell Gohan that he's really still strong enough to kill Cell, because his broken arm doesn't actually do anything to weaken him.
*** Cue a SugarWiki/MomentOfAwesome; Seeing both Goku (in spirit form) and Gohan doing the Kamehameha at the same time.
** In the movies, this is kinda Broly's thing. Example: Pre VillainDecay (well, we're talking about a show where the heroes are exponentially more powerful every season and the Return is about 10 years later), Broly is in a different league from the heroes, to the point no one in the entire cast can so much as stand toe-to-toe with him and trade blows. Broly is so powerful that the BloodKnight Vegeta is ''too scared'' to fight him until most of the cast is near death. Then Vegeta is put down in about 5 seconds. Goku, with the combined remaining power of the entire cast, lands one punch and it looks like Broly blows up from his own overpowered-ness. And then the planet blows up for unrelated reasons.
*** The Return: Well, teenage Gohan can go toe-to-toe with Broly now. Broly shows a tiny amount of what could be construed as fear when Gohan goes Super Saiyan 2... at which point Broly goes Legendary Super Saiyan and proceeds to NoSell anything Gohan throws at him. He reacts a little bit to being drowned IN LAVA. The following is possibly the most intimidating OutOfTheInferno ever. Because, y'know, LAVA. Gohan and his little brother Goten only manage to defeat him with assistance from the spirit of the then-dead Goku.
*** But only because a side attack from Trunks distracted Broly. Had Trunks not regained consciousness or if Broly ignored the attack, he almost certainly would have destroyed the Earth. Like father, like son.
** The Buu saga is arguably ''the'' darkest hour for the heroes: Buu has killed nearly everyone on Earth and absorbed Piccolo, Goten, Trunks and Gohan, the last of which Goku was planning to fuse with to defeat Buu. The only people left for Goku to fuse with are Mr. Satan the FakeUltimateHero, and Dende, who's needed to keep the Dragon Balls working. Only the surprise return of Vegeta (who had previously died in a failed HeroicSacrifice) turns things around.
** King Piccolo also comes ''very'' close to winning during the King Piccolo Saga of the original ''Manga/DragonBall''. He got the Dragon Balls to give him eternal youth and killed the dragon so no one could ever use the Dragon Balls against him. He also murdered a large number of the strongest fighters in the world, beats Goku so bad that his heart stops, and seizes control of the entire world, turning it into a living hell. The ''only'' reason he ultimately lost is because he never anticipated that Goku was NotQuiteDead.
* Manga/{{MAR}}, at least the anime version anyway. Everyone except Ginta, Babbo and Jack are dead, the BigBad is attacking Earth, and it looks like all is lost. Then Snow merges with Koyuki to allow Ginta to use the magic stone inside of her to defeat the Orb and resurrect everyone. Think about that, if Snow hadn't died beforehand, everyone would've been screwed. The manga averts this however, with a laughably easy final battle in which none of the heroes even get so much as a scratch.
* ''Anime/MazingerZ'': Often Dr. Hell and his followers were on the brink of winning, and only through of extreme competence and sacrifice of Kouji and his allies or of utter incompetence of Hell's minions, the situation was saved. It happened several times when they very nearly took the Institute over (the most prominent of them happened in episode 57) or invaded it successfully (episode 87), or managed to steal a sample of Alloy Z... However the most notorious of them happened in the last episode when [[spoiler: Archduke Gorgon's {{Robeast}}s destroyed Mazinger-Z and demolished the Institute. Tetsuya's BigDamnHeroes moment saved Kouji's life, but the villains finally were victorious against Mazinger.]] That story was greatly expanded in the Mazinger vs Great General of Darkness movie.
** ''Anime/GreatMazinger'': Several of them. Two of them stand out:
*** In the Gosaku Ota manga episodes, Great Marshall of Darkness sucessfully blackmailed Japanese army into destroying Great Mazinger and the Fortress of Science. The army bombarded the Fortress and stormed into the place before blowing it up completely, and the heroes were forced to flee and lie low for a while. Meanwhile, Mykene army conquered Japan.
*** In the last episodes of the anime and Gosaku Ota manga, the Mykene army struck the Fortress [[spoiler:and in the manga, Marquis Janus traped Misato and cut her in half]], and attacked Mazinger-Z and Great Mazinger separately. Kouji and Tetsuya nearly got killed, and [[spoiler:Prof. Kabuto commited a HeroicSacrifice to save Tetsuya.]] The generals of the Mykene army laughed. [[RoaringRampageOfRevenge Five minutes later they were not laughing]].
** ''Anime/UFORoboGrendizer'': One of the best examples happened in the two-part finale of the first season. Grendizer had been beaten by two {{Robeast}}s and forced to hiding, Kouji's TFO had been badly damaged, [[TheDragon Blackie]] had taken control of the Science Space Center and tortured Dr. Umon. When Duke returned, [[spoiler:he managed beat both mechas, saving his friends and destroying Blackie's command ship.]]
%%* Occurs in all five of the final battles of ''Franchise/SailorMoon''
* It's an unwritten rule in ''Anime/YuGiOh'' [[Anime/YuGiOhGX and its]] [[Anime/YuGiOh5Ds spinoffs]] that the protagonist can't win with more than 500 Life Points.
** Sometimes subverted or outright averted, most notably in [[Anime/YuGiOh5Ds 5Ds]], when BadassNormal Crow wipes the floor with some security guards in about one turn. Also, Yusei [[spoiler: defeated Kiryu with 1400 LP on his second try]], so the above rule might remain unwritten.
*** But Crow plays [[GameBreaker Blackfeathers]]...
*** ...Wait, why are security guards playing [[SeriousBusiness Duel Monsters]]?
*** [[WebVideo/YuGiOhTheAbridgedSeries "This is Japan, Mokuba. Card Games are the ONLY LAW."]]
** ''[[Anime/YuGiOh5Ds 5Ds]]'' had quite a few [[NearVillainVictory Near Villain Victories]] at the start of the Dark Signer arc - mostly due to the [[EldritchAbomination Jibakushin]]. On two occasions, the protagonists only survived due to timely [[PlotDrivenBreakdown Plot Driven Breakdowns]].
** The "Waking The Dragons" filler arc also had Yugi win his first duel of the season with 1000 Life Points left.
** In the last duel of the "Waking the Dragons" arc, Yugi wins with no life points. He plays a card that [[HeroicSecondWind lets him summon a monster to act as his life points.]]
*** Kiryu did that too during the Crashtown arc too... And Rua during the duel with Aporia in the Arc Cradle... Heck, the anime likes to throw the established rules of the game out the window sometimes.
** In the final Duel of the third season of GX, Yubel uses a card that forces Jaden to add one of 5 cards to Yubel's hand every time he uses 2 Spells. It eventually comes down to two cards: Grinder Golem, which would cause Jaden to lose due to [[AttackReflector Yubel's own effect]], and Super Polymerization, which is a MacGuffin that can [[ApocalypseHow destroy multiple dimensions at once]]. Jaden goes for Super Polymerization, and Yubel is about to pull off her master plan with it until Jaden alters the card's targets to their ''souls'', forcibly ending the Duel.
** Taken UpToEleven in [[Anime/YuGiOhZexal Zexal]], where Yuma hits 100 LP in nearly every duel.
** ''[[Anime/YuGiOhVRAINS VRAINS]]'' has GO Onizuka's entire Dueling style exploiting this trope. He allows his opponent to seemingly get the advantage on him so he can stage a comeback victory.
* ''Anime/RODTheTV''. Joker has Junior, with the intention of using his body to house the Gentleman (the former head of the British Library whose soul is in a set of books), and is set to brainwash the whole world into believing the British are all powerful (and somehow transforming reality into something 19-century). The heroes are there but since paper is their main weapon, there's none on hand. Trying to talk things out doesn't work. Nenene, who throughout the series was stressing over writing a novel and had only recently finished it, sacrifices the unpublished novel, which is more than enough artillery for Yomiko and the Paper Detectives to stop the baddies.
* ''Manga/TwentiethCenturyBoys'' uses this to great effect. Friend, for one, [[spoiler:actually ''succeeds'' in ruling the world and being hailed and loved as the world's savior]]. It's only when [[spoiler:he decides to destroy it]], that things start to turn in our heroes favor.
* ''Anime/{{Monster}}'' has one at the end when, following the Ruhenheim Massacre, [[spoiler:Johan very nearly coerces Tenma into shooting him and thus corrupting himself forever by threatening to kill a young boy only to be shot in the head by the boy's father at the last minute]].
* The goal of the bad guys in ''Anime/DigimonFrontier'' is to destroy the digital world piece by piece and feed it to Lucemon, thereby [[SealedEvilInACan freeing him from his prison]]. The heroes do all right at first, but then they come up against the Royal Knights, who ''repeatedly'' take out a chunk of the world and the heroes barely escape with their lives. Eventually the Knights succeed in taking the entire planet, forcing the heroes to take refuge on the moons. They're able to rally and take out the Knights at this point, but that still means Lucemon's back, and he's able to start an invasion of the human world before he's defeated.
* ''Anime/DigimonXrosWars'' does it twice. First it seems [=DarkKnightmon=] has completely absorbed his brother Bagramon till Bagramon fights back and absorbs him. Then Bagramon has the digital world and earth under his power, and prepares to destroy everything and remake everything in his will with the Code Crown power, [[spoiler: and just he is about to finish of Taiki Shoutmon appears and saves him, because the Code Crown chooses Taiki over Bagramon, and the tables start to turning in favor for the good guys there]].
* Oh good ''Lord'', ''Manga/FullmetalAlchemist''. In Chapter 104, [[spoiler:the BigBad, Father, absorbs the souls of everyone in the country and eats [[{{God}} the Truth]], making him powerful enough to conjure a sun in the palm of his hand]]. Luckily for the world, [[spoiler:Hohenheim had a circle in place to reverse it, leaving Father in a state of SuperpowerMeltdown due to not having enough souls to contain Truth]]. At which point [[SugarWiki/MomentOfAwesome awesomeness ensued]].
* ''Anime/TokyoMajin''. The heroes are up against a GodMode evil spirit (Yagyu Munetaka) who eliminates all the main & supporting cast heroes--which adds up to a fight of about TWENTY on ONE. Only the resident badasses are even able to deal damage to him. With all your typical anime Badass superpowers present. There is much buildup that they're likely to lose unless they unlock all four Godbeasts to turn Hiyuu into what amounts to the ultimate hero of awesomeness. So, as most of the cast lies there broken, dead or dying, in from left field comes the final Godbeast's vessel and bam, the Hero of Ultimate Bullshit is awakened. Screaming J-Rock in the background. [[spoiler: HopeSpot. Hiyuu STILL LOSES. And the heroes finally answer with their own GodMode HeroicResolve as TheChick brings everyone back to life, declaring they will keep fighting until they win.]]
* In ''Anime/PokemonZoroarkMasterOfIllusions'', BigBad Kodai almost succeeded in opening the Time Ripple...[[spoiler:but it was an illusion -- [[SpannerInTheWorks Zorua had luckily broken his illusion canceler when attacking him]]]].
** Also, in the TV special ''Anime/PokemonMewtwoReturns'', Giovanni came ''very'' close to success.
** Though Team Rocket many times has successfully captured Pikachu, they're almost immediately thwarted. However in "A Scare to Remember", they came closer than they've ever got before when Pikachu developed amnesia and was separated from Ash. Team Rocket successfully persuaded Pikachu that he was a member of their team, and Pikachu attacked Ash Ketchum without hesitation. Though Pikachu would regain his prior memories, and give a little payback to Team Rocket, it was pretty weird to hear James ordering Pikachu to use Thunderbolt.
** An early episode of ''Sun and Moon'' gets even closer when TR's Mimikyu and Mareanie are able to defeat Pikachu and Rowlet in a Double Battle fair and square. The only reason they don't get away with nabbing Pikachu is because [[DiabolusExMachina Bewear steps in to take the villains to its cave at the last second]].
* In ''Manga/ProjectARMS'', Alice has possessed Katsume, Ryo appears to have no choice but to kill them both, Keith White is quickly on his way to being a living god and destroying everyone on the planet to prove it, and the ARMS weapons - the only things that have a chance of stopping him - have been deactivated. [[spoiler:It's only after Kei is able to appeal to Azreal and get the ARMS weapons back up that things start to turn in their favor.]]
* In ''Manga/{{Bleach}}'', [[BigBad Aizen]] has [[spoiler: fused with the Hogyoku]], [[CurbStompBattle beaten the Court Guard Squads]], killed [[spoiler: [[GoodAllAlong Gin]]]], and is going to kill Ichigo's friends and take over the universe when Ichigo arrives as a [[spoiler: PhysicalGod]] and [[spoiler: [[BrokeYourArmPunchingOutCthulhu defeats him at the cost of his powers]].]]
* ''Anime/MobileSuitGundamZZ'': Neo-Zeon is in control for the series: the AEUG is barely hanging on and is little more than an annoyance to the revived Zeon. Then, just as Haman Karn is about to solidify her control over the Earth Sphere, an EnemyCivilWar erupts and Neo-Zeon rips itself apart, allowing the Federation's previously-outmatched forces to come in and sweep up the pieces.
* Also happened in the original ''Anime/MobileSuitGundam'': early in the One Year War, the Battle of Loum saw Zeon wiping out most of the Federation fleet and capture its commander general Revil, and the Federation was about to surrender when Revil managed to break out and make a RousingSpeech that evidenced how Zeon was actually in ''worse shape'' than the Federation, resulting in the Federation soldiering on and continuing the battle. Even then, Zeon had invaded Earth and occupied most of Europe, North America, northern Asia and chunks of Africa. That's the situation at the start of the series, and it's only halfway through it that the Federation scores a decisive victory and retakes Europe and Asia, and it's hinted that the major contribute of the heroes is to ''distract'' Zeon's armies from the war by bringing a lot of firepower too near Zeon's major industrial hubs on Earth, forcing them to redeploy and giving the Federation much needed breathing space to marshal up its [[WeHaveReserves much bigger army]] and unleash it on Zeon's occupied territory.
* This trope appears to be a favorite of Hirohiko Araki, as every villain of ''Manga/JojosBizarreAdventure'' often comes only a hair's breadth away from killing all the heroes, only to be defeated by circumstances they couldn't predict:
** ''Battle Tendency'': [[spoiler:Kars finally becomes the UltimateLifeForm with CompleteImmortality after obtaining the Red Stone of Aja. His triumph becomes his curse when Joseph reacting on instincts uses the Stone to launch Kars into space with a volcanic eruption. Kars is left adrift in space, trapped in a form that is half-mineral half-flesh.]]
** ''Stardust Crusaders'': [[spoiler:Nearly all the heroes are dead, DIO has acquired a massive power boost that allows him to stop time on such a scale that Jotaro simply can't keep up, and in the end, DIO is defeated by Polnareff's intervention, and eventually, Jotaro becoming able to stop time himself.]]
** ''Diamond Is Unbreakable'': [[spoiler:Kira acquires a seemingly foolproof power that allows him to constantly kill and rekill any potential witnesses until he's satisfied that his secret identity is complete. In fact, at one point he manages to kill ''all'' the heroes, but he doesn't realize it because the power doesn't include awareness of what happens in time loops (the only way to find out would be to go through another loop and see who just randomly explodes). Only because of some quick thinking from Hayato are the heroes finally able to find him and defeat him for good.]]
** ''Vento Aureo'': [[spoiler:Diavolo has nearly wiped out all opposition, and is only moments away from acquiring the Arrow, but is only defeated by Bucellati, Trish, and Giorno snatching it away from him in the last second.]]
** ''Stone Ocean'': [[SinisterMinister Enrico Pucci]] succeeds in [[spoiler: killing all of the primary protagonists (and in a round about way everyone on earth), and accelerating the universe through a second big bang]]. The only thing preventing a DownerEnding is [[spoiler: Emporio defeating him at the last second with Weather Report, preventing the new universe from lacking a Joestar bloodline]].
** ''Steel Ball Run'': This actually happens ''twice''. [[spoiler: Gyro dies, and Johnny is left to fight allone against the seemingly NighInvulnerable Funny Valentine. Crippled, without his horse, and with only one bullet left, Johnny finally understands Gyro's dying words and unlocks the ultimate form of his Stand.]] Following this, [[spoiler:the alternate universe Diego Brando actually ''beats'' Johnny, rendering him helpless while Diego wins the race, and is just about to ensure that the Saint's Corpse will remain in his possession, when Lucy Steel arrives with the original Diego's head, which merges with the second Diego and blows his head up. For an extra kicker, since Diego can't claims his prize money due to being..well dead. He's disqualified and the it goes to a runner up. A much less jerk-ass character.]]
* In ''Anime/UmiMonogatari'', Sedna comes ''extremely'' close to winning. By the end of episode 11 she has absorbed Marin and Kanon's combined power and shattered their transformation stones, rendering them completely incapable of stopping her. She then floods them with darkness and nearly kills them before [[spoiler:they realize what the darkness is]].
* In the 24th episode in the second half of the first season of ''LightNovel/SwordArtOnline'', Oberon cuts Kirito and Asuna's reunion short and spams his Game Master status, pinning Kirito on the ground with gravity-based magic, then impales him with his own sword and then proceeds to tear parts of Asuna's garments off, and lick her while sexually assaulting her, and then threatens that once he's done that in the virtual world, he'll do the same thing to Asuna in the real world, while she is in a coma, in her hospital bed, woth Kirito unable to stop him. Just as he's about to give up in his NearDeathExperience, the digital spirit of Kayaba, the antagonist from the first half, who was disgusted with Sugou's abuse of the system, gives Kirito his system administrator privileges and a HeroicSecondWind, allowing Kirito to have control of the system, reduce Oberon to Level 1, take away his control of the system, turn off his pain absorber, and defeat Oberon and save Asuna.
* Happens in Anime/TheBraveFighterOfSunFighbird.

[[folder:Comic Books]]
* Classic Marvel tale where Kang The Conqueror realizes that all he needs to defeat the ''[[ComicBook/TheAvengers Avengers]]'' is to get a [[EvilKnockoff Robot Spider-Man]] to join the team. The robot's turned away because no one liked Spider-Man, so it makes up a story about knowing where missing teammate IronMan is. On the rescue mission the robot systematically separates and takes out all the Avengers, but before he can finish them off the real Spider-Man shows up upset at the impostor and in battle figures out how to shut off the robot. Predictably, Kang learns of his failure and hangs his head in shame.
** This plan worked so well though that when the robot got turned back on by accident it, once again, managed to subdue the current lineup of Avengers, and that wasn't even its goal this time. Luckily, [[ComicBook/TheCloneSaga Spider-Man's clone]] happened to be in the area.
* This trope seems to be very common for Kang; in the "[[ComicBook/TheKangWar Kang Dynasty]]" storyline, he [[spoiler: nukes Washington DC and conquers the entire world. It takes a group of off-world heroes commanding a very powerful alien device to even begin to overthrow him, and they still would have failed Kang's son hadn't betrayed him.]]
* ''ComicBook/{{WITCH}}'' ''loves'' this trope, having pulled it in every major story arc ''at least once''. The Trials of the Oracle arc takes the cake, as it does it three times: first the arc ''starts'' with [[spoiler: ''Phobos'']] taking over Kandrakar under everyone's nose, then the Guardians retrieve Elyon and gives her back the Crown of Light with her powers only to discover it was actually a transformed [[spoiler: Cedric]], and then, after [[spoiler: Cedric]] has been recaptured and [[spoiler: Phobos]] has thrown himself in the infinite to not be recaptured or having to face another NoHoldsBarredBeatdown at Will's hands (especially now that she doesn't have to hold back), ends with [[spoiler: Phobos]] returning thanks to his ace in the hole and nearly defeating the Guardians before a chance accident frees them from his hold as he's real enough to be disintegrated.
* ComicBook/SecretWars has this. Doctor Doom takes the Beyonder's powers and becomes omnipotent. The heroes try to talk him into releasing his power and ... he destroys the lot of them. This is an issue cliffhanger. All the heroes ''die.''
* In ''ComicBook/TheTransformersDarkCybertron'', a badly injured Megatron states that the Simanzi Massacre, where half of Cybertron's already-depleted population died, and part of the planet was superheated to the extent that it glowed, was the nearest the Decepticons ever came to winning the war.

[[folder:Fairy Tales]]
* "[[http://www.surlalunefairytales.com/eastsunwestmoon/stories/norroway.html The Black Bull of Norroway]]" is the example of eucatastrophe cited by Tolkien in "Literature/OnFairyStories": the heroine has, after a long and miserable quest, won her way to where the prince is. She can't get at him, though. She bribes the princess who intends to marry him, and gets to his bedchamber, to find that she can't wake him. (The princess drugged him.) She tries again. And again. And the third time, the prince had been told by some servants that someone had been begging him to wake up during the night, and doesn't drink the drug.

[[folder:Fan Works]]
* In the WesternAnimation/JackieChanAdventures fic ''FanFic/QueenOfAllOni'', Queen Jade comes up with a plan to steal the captured masks. [[spoiler: It's based off what happened when Dark Jackie stole the Talismans, and although the mask is attached to Captain Black, the plan still works to a point, Jade uses the mask to sneak into Section 13, and if it weren't for Wisker's interference, SHE WOULD HAVE SUCCEEDED!]]
** Ikazuki and the mask-empowered Hak Foo come closer to totally defeating the J-Team in combat than any other adversary, both only being defeated by unforeseen interference.
* All three of Trigger Happy Fanboy's ''Franchise/{{Pokemon}}'' fanfics have these. And considering the fact that they're all in the same universe, they live in a pretty deadly world.
** In ''FanFic/DanceOfDestiny'': [[spoiler: [[BigBad Kyurem]]'s]] subordinate, Dialga, has Celebi immobilized between dimensions, Darkrai is beaten into the ground by [[FireIceLightning Zapdos, Moltres, and Articuno]], Tianna is unconscious, and Axel is about to be eaten by the said BigBad. Cue [[spoiler: [[PapaBear Rayquaza]]]] to fly in and engage [[spoiler: Kyurem]] in battle. Axel [[spoiler: manages to revive Arceus, who opens up a can of RoaringRampageOfRevenge on Kyurem, and then traps the Legendary in the Giant Chasm for all of eternity.]]
** In the ''ForgetShipping'' duology (Let The Flames Begin/And Watch Cities Burn) [[spoiler: Ghetsis has the Griseous, Adamant, and Lustrous Orbs, Brendan has been captured by Giratina in the Distortion World and is about to be eaten, and Lucas has lost to N. Team Plasma has subtly expelled Team Galactic from Shinnoh and pronounced themselves as the saviors of the region, Dawn and May are on the run, and Cynthia is too busy fending off Ghetsis's Hydreigon to do anything to help.]]
** ''BloodInTheWater'' has the biggest NearVillainVictory of them all. Effectively, Josh HAS won. Anna and Siobhan have been stalled by fighting Franz, who is attempting to kill them with his Lugia. Skyla is being deterred by a brainwashed Rico. Giovanni is attacking Mewtwo with Genesect. Josh himself has beaten all of Haleigh's Pokemon and forced Arceus to intervene, pissing it off enough to use Judgment and level the island, exactly what he wanted to happen. Arceus is pulled back into its own dimension thanks to Josh's OlympusMons, and there is no way to win. [[spoiler: But then Giratina pulls a HeelFaceTurn and sides with Haleigh, forcing it and Haleigh to engage Josh and his Rayquaza in an aerial battle above the ruined city.]]
* In [[FanFic/EquestriaAHistoryRevealed Equestria: A History Revealed]], throughout the entire Equestrian Civil War, Nightmare Moon was allowing Celestia to string up many small victories, as a build up in order to ultimately crush all of her forces in the penultimate Battle of Canterlot with an army three times greater in number. The InUniverse historians agree that this event served as the crossroads of history, as Nightmare Moon should've easily won with such an advantage, and the results of the battle had the potential to shift the destiny of Equestria. But by some miracle, Celestia and her forces were able to pull through and gain the upper hand.
* ''WebAnimation/TurnaboutStorm'': Part 4/4 sees [[Franchise/AceAttorney Phoenix Wright]] completely out of evidence and witnesses that might exonerate [[WesternAnimation/MyLittlePonyFriendshipIsMagic Rainbow Dash]]. With no options left to the defense, the Judge delivers his verdict. [[spoiler:'''OBJECTION!''' [[BigDamnHeroes Fluttershy appears on the stand]] after realizing that she has new testimony based on evidence that had been presented earlier that day; evidence that leads to the extension of the trial, a new pony of interest being brought in for questioning, and pushing the series' conclusion to Part 5/4]].
* ''[[Fanfic/AFutureOfFriendshipAHistoryOfHate A Future of Friendship, A History of Hate]]'': At the climax of Episode 2, [[BigBad Ruinate]] -- having already [[TheWorfEffect defeated the Princesses]] -- succeeds in immunizing himself to the power of the Elements of Harmony, followed by neutralizing them completely by [[spoiler: [[EmptyShell destroying Twilight's soul]]]], leaving nothing to stop him from destroying Equestria. [[spoiler: Fortunately, [[BigGood Amity]] [[DivineIntervention intervenes]], using the bond between the Mane Six to restore Twilight and [[SoLastSeason unlock the full power of the Elements]], allowing them to defeat Ruinate.]]
* In ''FanFic/MegaManDefenderOfTheHumanRace'', Dr. Wily has come ''extremely'' close to winning the world and killing Mega Man at times. The most prominent example is Episode 11, where he ''would'' have won and killed him if not for [[spoiler:[=ProtoMan=] turning on him]]. Even after Wily loses in that episode, Mega Man almost dies anyway because of the wounds inflicted on him.
* In ''Fanfic/SuperSentaiVsPowerRangersTheLiveblog'', Radiguet would have won if he kept his pride in check. During Epic 34, he succeeded in breaking Rika, making her the host to the Eldritch horror. Then he revealed his plan to eventually kill her and make the Eldritch's powers his own. Later in the finale, he defeated the All-Stars, but the Scouts saved them in the nick of time.

[[folder:Films -- Animated]]
* Scar from ''Disney/TheLionKing'' [[MagnificentBastard not only succeeds in taking over Pride Rock,]] but actually holds onto this position for several years (despite a ZeroPercentApprovalRating) until Simba returns.
** And he almost won there as well. The only reason he didn't is because his FatalFlaw, {{Pride}}, came in as [[JustBetweenYouAndMe he decided to let Simba in on "a little secret" before killing him]] leading to Simba's UnstoppableRage.
* Jafar comes disturbingly close to triumphing over ''Disney/{{Aladdin}}'', but chooses to try and subject Aladdin to a FateWorseThanDeath rather than actually killing him. It's a bit more justified in the [[Disney/AladdinTheReturnOfJafar sequel]] since Jafar's a genie and can't directly kill Aladdin, but still, he comes close several times. And if it weren't for Iago pulling a HeelFaceTurn and betraying him, Jafar very likely would've won.
** Mozenrath keeps the tradition alive in ''WesternAnimation/AladdinTheSeries''.
* In ''WesternAnimation/TurtlesForever'', 2003 Shredder nearly manages to kill the Original Comic Turtles, nearly destroying every single universe, until he's done in by [[spoiler: Exploding Throwing Stars]] and [[spoiler: really bad timing by Bebop and Rocksteady, that's right, the 2003 Shredder was killed by ''Bebop And Rocksteady''.]]
* Mother Gothel has two instances in ''Disney/{{Tangled}}''. After manipulating Rapunzel into thinking Flynn abandoned her, she had her ready to willingly remain in seclusion forever. And later when Flynn comes to the rescue, she stabs him and Rapunzel is again ready to remain her wiling prisoner if she will let her heal Flynn.
* Lord Shen in ''WesternAnimation/KungFuPanda2'' was able to successfully take over Gongmen City, build up an arsenal of cannons, and capture the Furious Five, also seemingly killing Po in the process. He's in the middle of riding out on his fleet to conquer all of China when Po comes back to stop him and ''even then'' he needs to pull out an EleventhHourSuperPower to do so.
* In ''WesternAnimation/BarbieAndTheSecretDoor'', Malucia successfully steals all of Zinnia's magic, and [[spoiler:drains all of Alexa's magic just before her scepter explodes]].
* In ''WesternAnimation/BarbieMariposa'', Henna comes within two seconds of killing Queen Marabella, becoming Queen herself and letting the Skeezites invade Flutterfield, but she wakes up just in time.
* In ''WesternAnimation/BarbieOfSwanLake'', after rendering the Magic Crystal powerless, Rothbart blasts Daniel and Odette with his magic, killing them both. He even gloats that he's won just before [[spoiler:their love and sacrifice destroys him]].
* In ''Disney/{{Zootopia}}'', [[spoiler:Bellwether]] has Nick and Judy trapped in a museum exhibit and darts Nick with the Night Howler serum to turn him savage. He hunts down Judy and with her back against the wall, he lunges forward to crush her throat while [[spoiler:Bellwether]] looks on triumphantly... only to discover, whoopsie, it was all part of a Batman Gambit and [[spoiler:Bellwether's]] gloating has been recorded leading to their arrest and the collapse of their plans.
* The climax of ''Disney/TheLittleMermaid'' has Ursula come with inches of total victory several times. On Ariel's last day as a human, Ursula under the guise of Vanessa uses Ariel's stolen voice to brainwash Eric into marrying her, and the voiceless Ariel helplessly watches [[TearJerker with tears in her eyes]] as the wedding ship departs. Scuttle and friends manage to interrupt the wedding just in time and break Ursula's magic shell, [[HopeSpot returning Ariel's voice to her and freeing Eric from mind control]], [[YouAreTooLate but the sun has already set]], so Ariel reverts to mermaid form and Ursula drags her back into the depths to a FateWorseThanDeath, [[TakeMeInstead whence Triton offers to take Ariel's place in the contract]], [[NothingCanStopMeNow allowing Ursula full reign over the ocean]]. When Eric attacks Ursula with a harpoon from a rowboat, Flotsam and Jetsam capture him and she nearly blasts him with Triton's trident, except Ariel grabs her and redirects the blast to kill Flotsam and Jetsam instead, driving Ursula to invoke MakeMyMonsterGrow. Following this, she traps Ariel in a whirlpool and charges a [[WaveMotionGun Wave Motion Trident]] blast for the coup de grace, but Eric commandeers a derelict ship and impales her with its bowsprit, [[HoistByHerOwnPetard causing the blast to backfire and electrocute her]]. Even in death, she almost [[TakingYouWithMe takes Eric down with her]].
* In ''[[{{Disney/TheRescuers}} The Rescuers Down Under]]'', [=McLeach=] comes very close to winning. In the climax, he's managed to capture Marahute and has Cody at his mercy, ready to be fed to the crocodiles, with Bianca and Jake unable to do anything. If he had just dropped Cody in with them immediately instead of toying with the boy, or if he'd managed to sever the rope holding Cody on his first shot, that would have been it, and he'd have gotten away [[KarmaHoudini scot-free]].
* ''WesternAnimation/{{Toy Story 3}}'': [[spoiler: Lotso leaves the gang to their immiment death in the incinerator by pretending to help them so he can escape, only for them to be saved by the aliens using a loader they found. Had the aliens not wandered away from the gang and found the loader that would eventually rescue them, [[TheBadGuyWins Lotso would have won]].]]
* In ''WesternAnimation/Cars3'', [[spoiler: Lightning willingly resigns himself from the Florida 500 halfway through to let his former trainer Cruz Ramirez fulfill her dream of becoming a race car, realizing she deserves to race more than he did, though he gives her his number first, and she eventually wins. Because she won and he didn't, he has to retire from racing for good following a bet with scheming businessman Sterling, but right when he is about to accept his fate, the winner board is updated so Lightning also won the race alongside Cruz (because he started it thanks to a [[LoopholeAbuse loophole]]), thus he wins the bet and doesn't have to retire. If it weren't for their shared victory, Sterling would've won.]]

[[folder:Films -- Live-Action]]
* The final battle over Area 51 in ''Film/IndependenceDay''.
* ''Franchise/StarTrek'':
** Done '''so''' very masterfully in ''Film/StarTrekIITheWrathOfKhan'' with the countdown to the Genesis detonation.
** Also done masterfully in the new ''Film/StarTrek 2009'', where the AxCrazy Romulan ship nukes one planet, wipes out two fleets, and actually arrives in orbit over San Francisco and starts drilling not even 300 feet from the Golden Gate Bridge before the BigDamnHeroes moment.
** In ''Film/StarTrekFirstContact'', the Borg have taken over most of the ''Enterprise''-E and are about to destroy Zephram Cochrane's warp spacecraft the ''Phoenix'', preventing first contact with the Vulcans, before Data reveals himself as a ReverseMole to the Borg.
* ''Franchise/StarWars'':
** Moments before Darth Maul's unlikely demise in ''Film/ThePhantomMenace'', Obi-Wan Kenobi was dangling from a wall fixture inside a bottomless pit, with Maul about to make a killing stroke.
** In ''Film/AttackOfTheClones'', Count Dooku has the surviving Jedi on Geonosis trapped before [[GunshipRescue the Republican gunships arrive.]]
** In ''Film/RogueOne'', it's a ForegoneConclusion that the rebels will succeed in stealing the Death Star plans. They still have to work for it, and even afterwards Darth Vader comes within ''inches'' of getting them back.
** Probably one of the best-known examples is in ''Film/ANewHope''. The Death Star is about to [[EarthShatteringKaboom blow up Yavin IV]] and the Rebel Alliance with it, their X-wing squad sent to destroy it have all been eliminated except for [[TheHero Luke Skywalker]], who at the moment is about to be shot down by Darth Vader, when the [[BigDamnHeroes Millennium Falcon appears out of nowhere]], knocking Vader's TIE fighter into space and allowing Luke to fire the shot to blow it up.
** The Battle of Endor in ''Film/ReturnOfTheJedi'' looked bleak for the Rebels for a while: Han and Leia were pinned down outside the shield bunker, unable to get in; the Rebel fleet was outgunned by the Imperial fleet, on top of which, the Death Star was more operational than advertised; and Luke, watching the fleet struggle, had just [[StrikeMeDownWithAllOfYourHatred given in to his anger and tried to kill Palpatine]], only to be stopped by Vader, who is bound to the emperor's will in that he must obey his master.
** In a deleted scene on the 2011 Blu Ray, the Death Star II was just about to obliterate the Endor moon right before it exploded, since it had been rotated out of position to face the moon. If Lando hadn't destroyed the reactor when he did, the Endor system would be filled with barbecued Ewoks .
* ''Film/PiratesOfTheCaribbeanOnStrangerTides'': Blackbeard successfully reaches the {{Fountain of Youth}} in the climax and, despite encountering and being impaled by his would-be assailant as well as the fountain being destroyed, manages to drink one of the chalices from the fountain before it dries out. The only problem was... [[PoisonedChaliceSwitcheroo he drank from the wrong chalice]].
* ''Film/BatmanAndRobin'': Poison Ivy might have failed to separate the Dynamic Duo and kill them with her kiss, but she still easily beats them both in a matter of seconds in her lair. She “breaks up” with Robin by shoving him into her pond and has her vines try to drown him, and Batman’s ambush quickly fails when vines grab him and start crushing him. Poison Ivy nearly escapes to join Mr. Freeze in freezing Gotham, with him completely unaware that she tried to kill his wife, but then Batgirl makes her entrance and manages to [[DesignatedGirlFight put Ivy in her place]].
* ''Film/TheDarkKnightSaga'':
** ''Film/TheDarkKnight''. Everything is at the brink of chaos and oblivion before the Joker's nihilistic dreams are proven wrong, and Harvey Dent is stopped just in time only for Batman to make a pretty hefty personal sacrifice to keep his legacy intact.
** Its follow up, ''Film/TheDarkKnightRises'', takes this a step further. Bane beats Batman and heavily injures him, flies him halfway the world to let him rot in an [[HellholePrison underground prison]]. Then takes over Gotham and turns it into a police state, likewise revealing the secret behind Harvey's death. The city nearly tears itself apart in the ensuring chaos which is just a waiting period so Wayne's energy reactor, now turned into an atomic bomb, can slowly overload. On the day they're meant to activate it, Bruce escapes his imprisonment just in time to help Gordan and the rallied remaining police mount war against Bane's forces. [[spoiler: And even when Batman gains the upper hand. The last minute reveal of Talia Al Ghul tips the scales once again, leading to a chase through the city to stop the reactor and Bruce seemingly sacrificing his life to save Gotham.]]
* In ''Film/OzTheGreatAndPowerful'', the titular character's balloon is shot down by a Wicked Witch and goes down in flames. Then Oz reveals to his friends that he faked his death and convinces the witches (and the people of Oz) that his death made him even more powerful.
* In ''Film/ReturnToOz'' the Nome King could have turned the protagonists to stone at any moment, but instead decides to have some fun by having them guess which ornament is the Scarecrow, giving them three guesses each and if they lose, they turn into an ornament. He is sure they won't be able to find the Scarecrow, however, [[spoiler: when only Dorothy is left, on her last guess, completely by chance, she restores the Scarecrow, and only after does she realize people from Oz turn into green ornaments. This in turn prompts the Nome King's VillainousBreakdown where he tries to kill the main characters, and would have succeeded had Billina not laid an egg, which fell down his throat and poisoned him.]]
* In ''Film/TheTerminator'', the Terminator comes ''insanely'' close to murdering Sarah Connor in the Tech Noir club and accomplishing [=SkyNet=]'s mission. He scours the club, and when he finally spots Sarah, the scene shifts to slow-mo with a [[DroneOfDread droning metallic theme]] in the background. He calmly walks over and targets his gun's laser sight directly at her head, as Kyle grabs his shotgun from across the room and frantically tries to get the other people out of the way. The Terminator is less than a second from blowing her brains all over the floor when Kyle blasts him. If you pay attention, the Terminator actually fired and ''missed'' Sarah due to the impact of Kyle's shot throwing off his balance by a few inches.
* ''Film/{{Jumanji}}'': After a long hunt throughout the film, Van Pelt corners Alan in the climax and finally seizes the oppurtinity to kill him. This actually would have happened if the titular cursed boardgame wasn't finished at the last second sucking everything that came out of it back inside it (including Van Pelt himself).
* Franchise/MarvelCinematicUniverse:
** In ''Film/TheAvengers2012'', Loki's Chitauri hordes have almost completely overwhelmed the Avengers. The Security Council, invoking this trope, decide to write New York off and launch a nuclear strike with the intent to wipe out the Chitauri, and the Avengers, and the millions of innocent civilians. The heroics of [[Film/IronMan Mr. Anthony Stark]] negate the need for such drastic measures.
** No other villain came as close to winning as [[spoiler:HYDRA]] in ''Film/CaptainAmericaTheWinterSoldier'', in a plan that spanned decades. [[spoiler:Through their infiltration of SHIELD and various governments]], they come within seconds of succeeding in their plan that would have resulted in the deaths of over 20 million people.
** In ''Film/GuardiansOfTheGalaxy'' [[spoiler: Ronan the Accuser has landed upon Xandar despite all attempts to stop his descent (and possibly even hastened by the efforts to slow him down). Rocket attempts a foolhardy charge out of anger, only to be casually swatted aside where he lands next to his damaged super-weapon, but he hardly has the time to fix it. Assured of his imminent victory, Ronan begins his EvilGloating. [[WeNeedADistraction And then Peter Quill starts]] [[CrazyEnoughToWork dancing]]]].
** ''Film/AvengersAgeOfUltron'' ends with [[spoiler: Ultron coming within mere ''seconds'' of triggering an extinction event comparable to the one that took out the dinosaurs by lifting a gigantic chunk of Earth high into the sky and then dropping it. He actually raises it to a necessary altitude ''and'' starts it on its way back down before the Avengers manage to break it apart enough to prevent a disaster.]]
** By the time Film/DoctorStrange2016 and Karl Mordo arrive in Hong Kong, Dormamu's zealots have already succeeded in destroying the final sanctum that protects Earth from being absorbed by the Dark Dimension. It's only by [[spoiler:Strange deciding he needs to break the rules to save the day and taps into the DangerousForbiddenTechnique of time manipulation to reverse everything to a point he and Mordo can swing the odds in their favor]].
* Occasionally in the ''Film/JamesBond'' universe, with ''Film/{{Goldfinger}}'', ''Film/{{Spectre}}'' and ''Film/YouOnlyLiveTwice'' being the most notable examples.
* At the end of ''Film/AllIsLost'', the man sets fire to his raft in an attempt to hail a passing ship. He jumps in the water, and, realising he has just burned his last lifeline, gives himself up to the sea. As he starts to sink, he looks up, and sees a small boat coming to rescue him.
* At the end of ''Film/{{Scream 4}}'' it seems like the killer's plan of recreating the Woodsburo murders - using the logic behind movie remakes - and [[spoiler: replacing Sidney as the FinalGirl will work. Then Jill makes a mistake when she tells Gale about their matching arm injury, which couldn't be possible unless Jill was the Ghostface that attacked her at the party. This leads to Jill dying at the hands of Sidney who she thought was dead.]]
* Common occurrence throughout the ''Franchise/IndianaJones'' series:
** ''Film/IndianaJonesAndTheLastCrusade'': First, Donovan thinks he’s found the grail when he enters its secret chamber. However, Elsa hands him a gaudy cup and he drinks from it, assuming he’ll become immortal, but he ages to death instead. Afterward, Elsa takes the grail within yards of the temple’s exit, but sets off a self-destruct sequence by stepping on the forbidden seal. In a TakeMyHand scenario, she reaches for the grail below as she hangs onto Indy over a chasm. Her hand can nearly grasp it, which encourages her to keep trying despite the danger. Right as she’s about to grab it, her other hand slips from Indy’s hold and she falls to her death.
** ''Film/RaidersOfTheLostArk'': Indiana Jones arrives on the Nazi-controlled island and finds The Ark, but the Nazis capture him and hold him and Marion prisoner while they open it up. [[spoiler:This turns out to be a bad idea on their part, due to God hating the Nazis and the fact that the Nazis look at the Ark when it is opened. The angels that come out of the Ark soon attack everyone except Indy and Marion (who kept their eyes closed). All the Nazis on the island are killed and Indy and Marion are freed, as when they reopen their eyes they find that their bonds are cut.]]
* At the end of ''Film/JurassicPark'', the raptors have surrounded Grant, Sattler, Tim, and Lex and are seconds away from killing them when [[spoiler:the ''T. rex'' suddenly shows up and kills the raptors, allowing the heroes to get away.]]
* In ''[[Film/{{Neighbors2014}} Neighbors]]'', [[spoiler:Teddy almost manages to get the cops to leave his party at the end of the film. Luckily, several developments allow his plan to fail.]]
* Happens twice in ''Film/RushHour2'': Chief Inspector Lee and Carter are both captured by Ricky Tan's right-hand woman, Hu Li. Just as she's about to kill the both of them, undercover agent Isabella Molina interferes and spares their life. Later in the film, Lee is captured again and is about to be tortured and killed by Hu Li but is yet again saved by Isabella Molina who reveals her identity as a U.S.S. secret service agent and attempts to arrest Hu Li.
* In both the past and the future in ''Film/XMenDaysOfFuturePast''. [[spoiler:Magneto almost succeeds at eliminating American leadership and ushering in an era of mutant tyranny backed by the reprogrammed Sentinels, and the Sentinels almost succeed in eliminating the last of the X-Men.]]
* In ''Film/KingsmanTheSecretService'', the outcome is a [[spoiler:''Partial'' Villain Victory. Valentine managed to activate his system during, at least, five minutes.]]
* Leonna Berrett, the control freak villain of ''Film/LeanOnMe'' almost gets this, but with most of the students passing the basic skills exam thanks to Clark's tactics, Clark is allowed to stay principal, much to her anger.

* Creator/JRRTolkien not only loved this trope (it appears throughout his books), he also proposed the term "eucatastrophe" for it and identified it as the typical ending of his definition of fairy stories in his essay "Literature/OnFairyStories". He also pointed out that a lot of beloved stories that don't fit into the fairy-tale category have a similar structure--like the central dogma of Christianity, which is about ''{{God}} Himself being killed,'' and then coming BackFromTheDead. Some examples of it in his own work:
** ''Literature/TheSilmarillion'': The final overthrow of Morgoth by the Valar, in response to the plea of Eärendil and Elwing, after Morgoth has destroyed Gondolin and taken over nearly all of Middle-Earth.
** ''Literature/TheHobbit'': The Battle of Five Armies, with the Goblins winning, the protagonists are saved by the arrival of the Eagles.
** ''[[Literature/TheLordOfTheRings The Fellowship of the Ring]]'': The near-capture of Frodo by the Ringwraiths at the Ford of Bruinen.
** ''[[Literature/TheLordOfTheRings The Two Towers]]'': Gandalf's arrival at Helm's Deep.
** ''[[Literature/TheLordOfTheRings The Return of the King]]'':
*** The Battle of the Pelennor Fields, saved by Aragorn's arrival at Minas Tirith.
*** The Battle at the Black Gate - in which most of the main characters expected to die in an attempt to give Frodo a chance - is not the primary eucatastrophe. The real one is Frodo failing at the end of his quest and, in a wonderful twist of fate, Gollum destroying the Ring ''by accident'', which turns everything around, defeating Sauron, which in turn confuses his armies, allowing Aragorn & co to win.
* In ''Literature/TheHoundOfTheDurbervilles'', Moran and Moriarty are actually on the back foot in the final story, as Moriarty is neglecting running his Firm to defeat his enemy, Mabuse. He does so, by manipulating Sherlock Holmes to find Mabuse. The plan then is for M&M to kill Holmes, return to London and get back to business, with none who can really oppose Moriarty. But Moran, who has been consistently treated poorly by Moriarty, feels that Moriarty would be fine seeing him go to jail to get on with his evil maths. Put up to it by Irene Adler, more or less, [[spoiler: Moran shoots Moriarty]], and the rest of Holmes canon (Holmes' near death, Moran's arrest) play out as usual.
* ''Literature/HarryPotter'' has tendencies in that direction.
** Most obviously in ''[[Literature/HarryPotterAndTheDeathlyHallows Deathly Hallows]]'': [[spoiler:everyone believes [[TheChosenOne Harry]] is dead. Neville]] has just tried to defy Voldemort, and is getting tortured [[spoiler:with a burning Sorting Hat]]. No one else dares to stand up to Voldemort, who is blockading the school with his Death Eaters. A lot of good guys are dead or wounded. Then [[spoiler: the centaurs attack, Neville breaks free and slices Nagini in half, and Harry reveals himself to be NotQuiteDead and zaps Voldemort.]]
* In Frederick Forsyth's ''Literature/TheDayOfTheJackal'', the titular VillainProtagonist actually manages to get off a shot at Charles De Gaulle [[ForegoneConclusion and]] [[DoomedByCanon miss]] before he is finally killed.
* ''Literature/ASongOfIceAndFire'' sees a strange variation in ''A Clash Of Kings'', with Stannis's forces being at the gates of King's Landing and looking for all the world like they'll take the city and end a lot of the political conflict of the story before Lord Tywin unexpectedly returns, smashing his host in a surprise attack with the Tyrells. The strange thing is that Stannis is the closest thing to a 'good guy' in the situation, although it's definitely not a total inversion due to the series's notorious GreyAndGreyMorality and BlackAndGreyMorality.
** The Lannisters themselves also get this. While it all seems that they have won the war, with most of their opponents now removed, and their rise to power unopposed. They soon start tearing each other apart as they hate each other more than their foes. The result leaves [[spoiler:Joffrey and Tywin]] dead, and Tyrion on the run, without the two of them to keep their reign together, Cersei starts running things to the ground when she becomes queen regent. Everything the Lannisters have fought for through, scheming, backstabbing and manipulation slowly crumbles as the whole realm is now against them, and the ones who are competent enough to hold it together are now gone. Also the war has [[PyrrhicVictory depleted their funds and the Iron Throne is still heavily in debt]], meaning the Iron Bank decides to support Stannis.
** Mance Rayder the King-Beyond-The-Wall has an army that vastly outnumbers the Night's Watch. Although he has been held off for days, he is wearing the Watch down and threatens in three days to have a horn blown that will apparently destroy the Wall. [[spoiler:Fortunately, Stannis has been convinced to respond to [[GondorCallsForAid the Night's Watch letters]] and despite his small force scatters the Wildlings and captures Mance.]]
* In ''Literature/WarriorCats'', Scourge kills [[TheChosenOne Firestar]], and is about to defeat [=LionClan=] when [[spoiler: Firestar, who is OnlyMostlyDead, is revived by [=StarClan=], to kill Scourge. This is because Firestar was given nine lives. However, there was still an off-chance that he would have died, given that Scourge killed the previous BigBad, who also had nine lives, with one stroke.]]
* The Yeerks are always on the edge of victory throughout the ''Literature/{{Animorphs}}'' series.
* In the ''Literature/{{Mistborn}}'' trilogy, Ruin very nearly manages to destroy the world before [[spoiler: Vin becomes a god, and then kills him via TakingYouWithMe]]. Even so, the world would probably still have effectively died if [[spoiler: Sazed hadn't taken the powers of both Ruin and Preservation,]] and [[WorldHealingWave fixed everything.]]
* The ''Literature/{{Inheritance}}'' Cycle begins with King Galbotorix having all but extincted Dragons and their Riders, ruling his Kingdom absolutely, with only a few pockets of resistance on its outskirts. Eragon, a rider trains to beat him, barely manages to prevent being captured for 4 books, only because Galbotorix does not want to kill him, much less won't just fly out to fight him with his Eldritch Abomonation of s Dragon. When the final confrontation begins, he calmly reveals he knows every "secret" they do, proceeds to defeat every countermeasure they had against him so effortlessly. Besides having years of experience, power, swordsmanship, wards against damage over Eragon (which in this universe, almost locks victory in) , he also reveals he has knowledge of The Word, allowing him to control the concept of magic itself.
* ''Literature/TheWheelOfTime'' has this on a ''schedule''. At the end of every Age, the Dragon fights the Dark One; if he wins, this trope; if he loses, even bigger catastrophe. However, it's possible that the Father of Lies was, well, ''lying'' about having won the battle in prior ages. Or it could be future ages and he just doesn't know the difference - the books make it pretty explicit that he's just outside of the Pattern and would be pretty alien to all sorts of its characteristics.
** Innumerable ones in the books themselves. When the party splits up, there can be as many as several ''for each segment of the main characters per book''. That can come out to a dozen or so of this trope.
** Both the Aes Sedai and the Dark One try to convince the Dragon that the other side is this trope. XanatosSpeedChess doesn't begin to describe it. The Dark One even explicitly says that the story is this trope, and it's been thousands of schemes for thousands of years in the making.
* Creator/DavidGemmell's novel ''Literature/{{Legend}}'' is about an undertrained and massively outnumbered group of defenders holding the line against an invading horde, knowing that they have no chance of actually defeating the invaders but hoping to take long enough to die that reinforcements will arrive. The horde is literally moments away from killing the last of the defenders when salvation arrives.
* Short story "Literature/ClockpunkAndTheVitalizer" comes pretty close to one. [[spoiler: The Vitalizer comes damn close to retrieving Dolores after her escape, thanks to both the flurry of city fixtures he flings at her during their downtown chase and just how run-down she is. If it weren’t for the other superheroes catching up, there’s a good chance he would’ve killed her.]]

[[folder:Live-Action TV]]
* The writers and producers of ''[[Series/TwentyFour 24]]'' have perfected this to such a degree that they should copyright this trope. The villains generally cause enough damage before they are defeated up to the point where the heroes simply won't get to celebrate.
* Likewise, ''Franchise/StarTrek'' is pretty adept at bringing our heroes to edge of disaster before they win the day.
** The Borg in ''Series/StarTrekTheNextGeneration'' mop the floor with Starfleet, kidnap TheCaptain, and make it all the way to Earth (as in, they park in orbit right above the Atlantic Ocean), before the ''Enterprise'' stops them at the last minute.
** So to, the Xindi superweapon in ''Series/StarTrekEnterprise'' is blown up moments before it was ready to deploy within miles of the Earth's surface.
** Unlike the top two examples, the Dominion actually managed to ''fire shots on the Earth's surface'', and succeeded in [[MonumentalDamage messing up the Golden Gate Bridge]]. Additionally, several shapeshifters made it to Earth and other Federation worlds, causing massive panic. For a moment, it really did seem that the Federation would meet its first defeat ever.
*** Not to mention the Dominion successfully conquering Deep Space 9, only to have the good guys retake it with divine intervention by the Prophets/wormhole aliens next season.
** ''Series/StarTrekVoyager'' had the 'Year of Hell', which was only undone with a last-minute suicide run.
* The best ''Series/BuffyTheVampireSlayer'' example comes at the end of season four, wherein Adam is only defeated by Buffy coming up with a spell to tap mystical ancient powers that give her the power, knowledge, and skills of Giles, Xander and Willow.
** The spell required that they be close by (no just popping a spell pill and rushing off to the enemy's lair) so they ''all'' had to infiltrate a fortified underground base safely, then successfully reach a room where they hopefully wouldn't be bothered by the ''rampaging monster hordes'' and then, even when the spell is activated, there's a) the possibility it won't work at all, b) the possibility it won't work as intended, c) the possibility of it not being reversible (effectively killing Giles, Xander and Willow while making Buffy almost a demigod, and the longer the spell is active, the higher than probability gets) and d) the (proven) possibility of bad side-effects. So, it was kind of a hail mary, not something anyone really wanted to do unless they had to.
** Seriously awesome when Buffy uses [[PhysicalGod Willow's]] power and Giles' knowledge to turn missiles into doves.
*** Another example comes during the final battle in season 7: Buffy and Robin Wood are both stabbed, The Slayers are being overwhelmed and killed by Turok Han, Spike and Willow are incapacitated, and [[spoiler: Anya]] is killed.
** The near-ending of 'Wish' almost makes Anya the most dangerous villain the Scoobies ever faced - not only does the wish cause the Master to take over Sunnydale and succeed in his newest plan, but by the end [[spoiler: Buffy, Angel, Willow, Xander and Cordelia are all dead, and only Giles breaking her amulet undoes it.]]
* Illyria of ''Series/{{Angel}}'' suffered this on her return. Despite the best efforts of the heroes to stop her, she successfully reached the dimension hiding her invincible army... only to find that the army had been destroyed in the ages since she was sealed away.
* ''Series/DoctorWho'' has a few examples, especially in the revival:
** In Series 2, the Daleks activate the Ark and spew out [[BiggerOnTheInside millions]] of Daleks, which immediately begin exterminating the population of Earth. Luckily for Earth the Doctor was still on the case...
** In Series 3, the Master actually succeeds in ruling Earth for 12 months, and is about to launch an attack on another planet when he's defeated. The heroes deliberately keep their comeback until the last moment, counting on the Master's sense of drama to give everyone on Earth a countdown before he strikes.
** The Series 4 finale has Davros literally seconds away from finally removing all non-Dalek life from existence. The scene itself and the leadup is pretty dark.
** At the end of Series 5, existence is literally wiped out for a brief time, and is saved only by Amy's consciousness. And so far, the perpetrators ([[spoiler:The Silence]]) have got off scot-free.
* In the BackStory to ''Series/BabylonFive'', the Minbari succeeded in obliterating most of [=EarthForce=] and had arrived at Earth with the intent to completely eradicate all humanity. Their sudden decision to surrender to the humans that they very clearly had on the ropes was one of the biggest plot points throughout the series.
* By the series finale of Series/{{Lost}}, [[spoiler:Smokey/Locke had successfully killed three of the six remaining candidates, managed to get the last ones to help him uncork the heart of the island, was about to escape on the Elizabeth boat with the island collapsing in his wake, and ''fatally stabbed'' Jack. He was going to deliver the killing blow and get off the rock when along came Kate...]]
* This is common for ''Franchise/PowerRangers'' as nearly every season has the BigBad nearly winning despite the victories and upgrades that the rangers have gotten during the season. Though special mentions include...
** ''Series/MightyMorphinPowerRangers'' - Rita Repulsa destroys the Thunderzords and by extension the Rangers' powers. They would be able to wreak their havoc on the world had the Rangers not gone to Ninjor and gotten new ones.
*** Followed by the villains annhilating the Command Center and stealing the Zeo Crystal at the conclusion of the ''Alien Rangers'' mini-arc. However, by the start of ''Series/PowerRangersZeo'', the Rangers are able to turn the tide by retrieving the Crystal (which Goldar & Rita had dropped while teleporting) and gaining new powers.
** ''Series/PowerRangersInSpace'' - The various villains from the previous Ranger series team up with Dark Specter and mount simultaneous attacks across the galaxy. They succeed in subduing all the Rangers and their various allies. The only thing that prevented them from winning [[spoiler:was a HeroicSacrifice by Zordon.]]
** ''Series/PowerRangersLostGalaxy'' - After Trakeena's fusion with Deviot increases her evil, she launches a massive Sting Winger attack on Terra Venture with all of them strapped with bombs. She succeeds in destroying two Megazords and nearly wipes out the civilians evacuating the colony. The Rangers use the [[Series/PowerRangersInSpace Astro Megaship]] to damage the Scorpion Stinger and it crashes on a nearby moon. However, Trakeena isn't done yet; with the massive power boost from the cocoon, she is able to energize the ruins of Terra Venture and sends it on a collision course for the civilian colony on [[spoiler:Miranoi]]. The Rangers try to defeat her, but to no avail. Leo uses his armor and fires a point blank shot at Trakeena, finally taking her down, but the colony is still in danger. Thankfully, the Galactabeasts are able to shift Terra Venture's trajectory away from the colony.
** ''Series/PowerRangersTimeForce'' - After [[spoiler:Frax is destroyed]], Ransik begins his final fight with the Rangers, minus Eric. The Rangers fight a valiant battle yet Ransik is still able to defeat them. Unmorphed Jen leads Ransik away from the others. As he gives chase into a warehouse he fires and accidentaly hits Nadira. [[MyGodWhatHaveIDone Shocked he almost killed his daughter, he turns himself in.]]
** ''Series/PowerRangersWildForce'' - Viktor Adler manages to truly become Master Org and preforms a ceremony to make an Org Heart which makes him nigh unstoppable. He destroys the Ranger's Power Crystals which in turn destroys the Zords, defeats and kills Animus, forces the Animarium back into the Earth and depowers the Rangers before sending his vines to take over Earth. It's only due to the Rangers unwilling to give up that it summons the remaining animal crystals to their aid and turns things around.
** ''Series/PowerRangersOperationOverdrive'' - Not actually a season finale. However, when Thrax, Rita Repulsa's and Lord Zedd's son, rallies the rest of this season's villains and they destroy the Rangers' link to the morphing grid, they go on to wreak their rampage on the world and would have done great harm, maybe even succeeded in their goals if Sentinel Knight hadn't [[spoiler:[[BigDamnHeroes brought five other Rangers from their timelines to fight them off]].]]
** ''Series/PowerRangersRPM'' - Not a season finale either, at first. The Rangers are fighting against the computer virus Venjix to prevent him from taking over Corinth, and eventually move onto a grander stage. However, when we begin the season he has already succeeded in destroying the rest of the world and Corinth is the only place he hasn't taken over/destroyed. At the finale, he has already converted the majority of the city's populace into cyborgs and has killed two of the Rangers. Luckily, the Rangers he killed are brought back and succeed in destroying him. [[BittersweetEnding Although even after the Rangers defeat him and his robots at the end of the season, it still doesn't change the fact that the rest of the world is a wasteland.]] Plus, Venjix might not be gone.
* Used magnificently in [[TheScarletPimpernel1982 the Anthony Andrew's version of The Scarlet Pimpernel]] [[spoiler: when Percy comes back from the "dead", having supposedly been executed by firing squad]]. The look on Chauvelin's face when he turns around and sees him standing there is absolutely priceless.
--> '''Percy''': My good fellow, I would never dream of depriving you of your moment of triumph. Alas, a moment was all I could spare.
* By the fifth season finale of ''Series/{{Supernatural}}'', Lucifer has hijacked Sam's body, and he and Michael are about to tear the world apart in the deathmatch of the century. Then Dean shows up in the Impala and his presence is enough for Sam to wrestle back control of his body and seal himself, Lucifer and Michael in an inescapable pit.
* A frequent occurrence on ''Series/StargateSG1''. The best example is probably the season 8 episode "Threads". Anubis is mere moments from destroying all life in the galaxy and no one can stop him...until Oma Desala saves the day via SealedEvilInADuel.

* In the [[Music/RhapsodyOfFire Emerald Sword saga]], near the end BigBad Akron has destroyed and conquered almost all the cities of Algalord, is holding the [[InfinityPlusOneSword Emerald Sword]] and is torturing TheHero and going to have him fed to water snakes. [[spoiler: [[TheDragon Dargor]]'s HeelFaceTurn is the only thing that bring forth a happy ending.]]
* The Ancient Bards song "Hope Dies Last" is about one of these.

[[folder:Professional Wrestling]]
* The 2011 Wrestling/{{TNA}} ''Genesis'', had only one baby {{face}} victory on the entire card and [[PowerStable Immortal]] won every last title belt. Then Wrestling/EricBischoff, having time to kill, decided to book more matches, which resulted in Immortal's centerpiece Wrestling/JeffHardy losing the World Heavyweight Title belt.[[/folder]]

* In "Neverland" from AudioPlay/BigFinishDoctorWho the Neverpeople come very close to piloting a Time Station containing an anti-time bomb onto Gallifrey, which will destroy the Web of Time. [[spoiler:The Doctor only just stops them by materialising the TARDIS around the time station.]]
** In the finale of series 2 of the New Eighth Doctor Adventures Morbius returns and takes away the Time Lord's power. He then rules an Empire for over ten years, conquering over ten thousand worlds including Earth. [[spoiler:Thankfully the Time Lords are able to pull a ResetButton.]]
** In the GrandFinale of the NEDA the Dalek Time Controller comes very close to activating a time engine that will send Earth through time and turn it into a plague planet which the Daleks will pilot through the Universe and use to infect worlds, having captured the Doctor, Susan and Alex, with Lucie in a Dalek Saucer which has been caught in a magna-clamp. [[spoiler:Though he is stopped it take two [[HeroicSacrifice heroic sacrifices]], making this one of Doctor Who's biggest [[DownerEnding Downer Endings]].]]

[[folder:Tabletop Games]]
* The ''TabletopGame/MagicTheGathering'' card [[http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=193467 "Near-Death Experience."]] The context is of fighting world-eating {{Eldritch Abomination}}s [[DidYouJustPunchOutCthulhu and winning]].

* In ''Theatre/PokemonLive'', Giovanni's plan works completely, and he tries to kill Ash and Pikachu with Hyper Beam after they served their purpose in his plan. If not for Mewtwo's intervention, he would have won.
* At ''Theatre/{{Amaluna}}'''s climax, [[HopeSpot Romeo reunites with Miranda in Purgatory]], [[DraggedOffToHell only for Cali to drag Romeo off to his infernal lair]], where he traps him in a cauldron, [[StewedAlive slowly cooking him alive]], while Cali and the [[FallenAngel corrupted]] [[PeacockGirl Peacock Goddess]] perform a juggling act with GreatBallsOfFire to celebrate his victory over his rival. Romeo manages to pull himself out of the cauldron before collapsing upon the stage, [[DisneyDeath seemingly dead]]. But then, [[RescueReversal Miranda arrives]], wielding the [[ChekhovsGun Moon Crystal]], to revive Romeo and summon [[TheCavalry the Valkyries]] to capture Cali.

* The plot of the ''VideoGame/AceCombat'' series revolves around this. The player is an AcePilot that acts as a tipping point in the war during gameplay, whereas the cut scenes revolve around the ramifications of the player's actions.
* ''Franchise/AceAttorney'': Phoenix Wright can never go into a trial and win, he has to be getting his ass kicked until he comes to a point where everything seems hopeless. That's when he can turn things around. Possibly was the same for Mia Fey. In general, near the end of every case there's a moment where e.g. the prosecutor points out that you have no decisive evidence to prove the murderer's guilt, and as the murderer stands there gloating and mocking you, Phoenix manages to get a bright idea at the last minute, or someone bursts into the courtroom with a piece of vital evidence ''just'' before the judge announces his verdict, etc.
** In the course of the series, Phoenix (deep breath): [[spoiler: defends the sister of his mentor, apparently accused by the ''victim'' of the murder, successfully brings about the downfall of a man blackmailing half the legal system, defends a ''hated'' prosecutor accused of killing a man a few days before, then successfully defends the same man for a crime committed fifteen years ago by a different prosecutor who had never lost a case before, by correctly accusing the ''same'' perfect prosecutor, takes down a ''viciously corrupt chief of police'' while defending someone who had ''already confessed to the crime repeatedly and in detail'', defended someone ''without his memory'', defended his assistant from a crime that, circumstances show, could only have been committed by said assistant, successfully maneuvered a ManipulativeBastard into confessing to a crime while his assistant was held hostage to ensure said bastard's acquittal, defended someone ''already found guilty'', and finally, successfully defended a woman he thought had tried to ''kill'' him because he was convinced of her innocence (oh, and the evidence is all against her, too).]] Lampshaded by the fact every case except one (and the ''series title'' in Japan), all have the word "Turnabout" in them, ''and'' how in the English versions he's named ''Phoenix'' for his tendency to "come back from the dead".
* In the climax of ''VideoGame/Uncharted4AThiefsEnd'', Rafe finally reaches Henry Avery's teasure and gains the upper hand over Nate during their battle. He actually would have had the chance to kill him if he wasn't distracted monologuing.
* In ''VideoGame/TheWorldEndsWithYou'' Kitanji has Neku at his mercy. His brilliant EvilPlan that he had spent the entire game setting up has come to fruition, leaving Neku alone and defenseless. The reapers summon a whole army of [[TheHeartless Noise]] and are about to erase Neku when the SpannerInTheWorks sets in.
* ''VideoGame/SoulNomadAndTheWorldEaters'' had a few when you were fighting the World Eaters, Raksha especially seemed unstoppable
* In ''VideoGame/DragonQuestIX'', after you defeat the BigBad [[spoiler:Corvus]] in battle, he says he will destroy the world anyways. Then [[spoiler:his one true love, a mortal named Serena explains she didn't betray him, at which point he stops]], invoking this trope.
* ''Franchise/FinalFantasy'':
** In ''VideoGame/FinalFantasyII'', just after you unseal and obtain the [[LastDiscMagic Ultima spell]], [[spoiler:the Emperor conjures a massive magical Cyclone and ''completely destroys'' most of the towns between Palamecia and Fynn, along with sucking up a good number of people from Fynn. The heroes then proceed to fly into the Cyclone and take down the Emperor...[[WhamEpisode only for things to get even worse from there.]]]]
** ''VideoGame/FinalFantasyIV'':
*** The FinalBoss has [[HopelessBossFight effortlessly overpowered you]]. It seems like all hope is lost until [[spoiler: every other characters transfer their messages to the heroes via a prayer, which completely heal everyone.]]
*** In the Underworld battle against Golbez, he uses Snare to trap everybody in place then knocks them out one by one. Before Cecil is killed, [[spoiler: Rydia pops in with the Mist Dragon and revives everyone.]]
** Repeated with the final battle of the sequel ''VideoGame/FinalFantasyIVTheAfterYears'', clearly as a ShoutOut with more characters being benched on the spaceship.
** ''VideoGame/FinalFantasyVI'' deserves special mention for including that one rare time when the hero ''doesn't'' save the day. It even goes as far as to place the heroes at the exact right time and place to save the world from imminent destruction, and then have them ''fail''. [[DoubleSubversion The heroes manage to kill Kefka and save the world in the end]], but for a while there, the villain did win.
** ''VideoGame/FinalFantasyVII'' has [[BigBad Sephiroth's]] plan for Meteor to smash into the Planet almost succeed, even ''after'' his defeat. It's Divine Intervention that saves the day in the end.
** ''VideoGame/FinalFantasyIX'' does this during a HopelessBossFight.
* ''VideoGame/StarOceanTheSecondStory'' also deserves this mention: [[spoiler: At the end of Disc 1 you face the BigBad for the fate of the world of Expel. You get ''trounced'', Expel is destroyed (although returned to existence later) and you wake up on the BigBad's home planet.]]
* The 2 VideoGame/CustomRobo games use this at their seemingly invincible final bosses. The DS's version's example is a lot like the FF 4 one.
* ''VideoGame/SuperMetroid'' has another example when you nearly die fighting the FinalBoss.
** As does ''VideoGame/MetroidFusion''.
** By making planetfall on [[spoiler:Phaaze]] in ''VideoGame/MetroidPrime3Corruption'', Samus winds up giving her enemy all the cards as she [[spoiler:becomes so heavily Phazon-corrupt that she can't even leave the planet (her ship no longer acknowledges her as "Samus Aran", the Phazon having mutated her so severely). As Samus has killed off her other Phazon-enabled bounty hunter associates over the course of the game, she's the only one left with the physical constitution to even be on the planet and being there will eventually terminally corrupt her anyway]]. All she can do is press on to the final battle and hope that she holds off terminal corruption long enough to finish things. Gameplay-wise, this is conveyed by Samus's health becoming a slowly ticking timer that can only be rewound by unloading Phazon along the way to the final fight. The more Energy Tanks you have, the longer you can go without exhausting the buildup of Phazon but it is merely slowing down an inevitability.
* ''VideoGame/CastlevaniaSymphonyOfTheNight'' might do this during the prologue battle with Dracula. If your health reaches 0, Maria runs in and casts a crap load of buff spells turning the fight into a ForegoneVictory.
* There isn't a final boss from a ''VideoGame/PaperMario'' game that ''doesn't'' do this. ''VideoGame/SuperMarioRPG'' and ''[[VideoGame/MarioAndLuigi Mario & Luigi]]'' are immune. So far.
** This also happens in main-series games. Notable is ''VideoGame/SuperMarioGalaxy'', where Bowser is minutes away from completing his plan when Mario arrives.
* ''Franchise/TheLegendOfZelda'':
** Ganondorf in ''[[VideoGame/TheLegendOfZeldaOcarinaOfTime Ocarina of Time]]'' scores a fairly impressive victory during the first arc of the game -- he ''[[MacGuffinDeliveryService tricks the heroes into doing most of the work for him]]''. He then kills the King, conquers Hyrule and reigns supreme for seven years, while the rightful heir to the throne has to [[strike:change her gender]] cross dress in order to effectively hide from him, and TheHero is put in an enchanted sleep that will allow him to grow up sufficiently in order to put the kingdom back to rights.
** ''[[VideoGame/TheLegendOfZeldaTheWindWaker Wind Waker]]'': At the climax, Ganondorf gets all but one foot away from achieving his goal of acquiring the Triforce once and for all, something he'd spent five games trying to do. Pity for him that the King of Hyrule beat him at the last second.
** In ''[[VideoGame/TheLegendOfZeldaTwilightPrincess Twilight Princess]]'', Zant and the Twilight took over all of Hyrule except for the backwater province that also happened to be Link's home, and then got beaten back into its hidey hole, only to be later defeated and left slumped in his throne while Link goes to rescue Zelda.
** ''VideoGame/HyruleWarriors'' sees Ganondorf triumph over the heroes, personally defeat Link and Zelda, and claim all three pieces of the Triforce. It's actually a bit of a jaw-dropper, since the heroes only ''just'' manage to claw back enough power to win. [[spoiler:And you ''play as him'' as he crushes Hyrule.]]
** In ''[[VideoGame/TheLegendOfZeldaTheMinishCap Minish Cap]]'', Vaati, after disguising himself as the King of Hyrule, getting the soldiers away from the castle by telling them to look for the Light Force, and turning everyone except Link and Ezlo to stone, comes dangerously close to killing Zelda when Link barges in, interrupting him -- after having to go through three battles directly beforehand, a bell chiming after the first two. Upon the third bell, Vaati would have completely drained Zelda of the Light Force, and the penultimate battle in the game is against the notoriously sturdy Darknuts. The third bell is even ''timed'', so if you/Link fail(s) to destroy them in time, Zelda is dead and Vaati actually does win, though this is not recognized as actual canon.
* At one point in ''VideoGame/SuperSmashBrosBrawl'', ''every single playable character'' (and Master Hand) is dead (well, trophyified). Then Dedede's timed badges go off and Luigi, Ness and Kirby revive. Thanks to them (and Sonic, who comes in to prevent the BigBad from killing everyone again), the whole roster is again able to kick ass.
* ''[[VisualNovel/FateStayNight Fate/Stay Night]]'', Heavens Feel. [[spoiler:First Saber is gone. Very gone. Then in quick succession, Archer dies, Berserker follows and Shirou loses an arm. Plus, Saber is NotQuiteDead... but that's not a good thing. Then Sakura is revealed to be the Shadow, plus Zouken Matou controls her. And Berserker is back, plus blind and insane... insaner.]] So many things go wrong that by the time you get to the end [[spoiler:you're down to Tohsaka and Shirou. Tohsaka has a weapon she isn't sure will work and Shirou has severe brain damage plus a limited amount of times he can project before he'll die. Luckily, Sakura]] makes things a bit easier [[spoiler:by killing True Assassin and Zouken for them.]]
* ''Franchise/MortalKombat''
** ''VideoGame/MortalKombat3'': To break it down, Shao Khan revives his dead wife on Earthrealm, allowing him to step through the boundaries separating it from Outworld and claim her, thus forcing a merger of the two realms without the need of the eponymous tournament. Not only that, but he immediately steals the souls of everyone on Earth, and sends out extermination squads to take care of {{The Chosen One}}s who had their souls spared. He barely avoided victory, due to his underestimating the power and tenacity of his foes.
** ''VideoGame/MortalKombat9'' sees things get worse: [[spoiler:Raiden's attempts to prevent Armageddon see the situation deteriorate until the only surviving Earthrealm warriors are Johnny Cage and Sonya Blade. The only reason Shao Khan's attempt to conquer the realm failed was because Raiden finally realized that the future message of "He must win" referred to Shao Khan: allowing him to conquer Earthrealm would force the Elder Gods into action.]]
** ''VideGame/MortalKombatX'' had this happen ''twice''. The first time Shinnok manages to reach the Jinsei, essentially the life force of the Earth realm, and is about to absorb it. But Johnny Cage's Shadow Power turns out to be able counter his own and, combined with Johnny's fighting skills, he's able to beat Shinnok to which Raiden seals him within Shinnok's own amulet. [[spoiler: The second time happens years later, after a convoluted set of events, Shinnok is freed and once more attacks the Jinsei. This time he ''does'' absorb it, gains a monstrous new form and almost brings about Earth's destruction. But Johnny's daughter, Cassie, fights him this time and well, HistoryRepeats, only this time Shinnok is killed and Raiden manages to undo the damage...if not with unexpected [[KnightTemplar side effects to his personality.]]]]
* The ''VideoGame/{{Fallout}}'' series does this in every episode.
** ''VideoGame/{{Fallout|1}}'': while you are hunting for the Master and the Vats, the mutant army is on the doorstep of Vault 13.
** ''VideoGame/{{Fallout 2}}'': by the time you get to the Oil Rig, the Enclave is ready to launch the modified FEV biotoxin into a jetstream which would completely depopulate North America.
** ''VideoGame/{{Fallout 3}}'': fortunately for the good guys, the Enclave doesn't know the code to activate Project Purity which results in the Brotherhood launching a desperate siege and pushing them out of there. However, the Enclave was about to use their KillSat on the Citadel afterwards so it counts as two.
** ''VideoGame/FalloutNewVegas'' has this as a ''possible'' ending; depending on how thoroughly you complete sidequests and make friends with folks that have a lot of firepower, the ultimate battle for Hoover Dam is either an unbelievably harsh battle of attrition, or a hysterically drawn out CurbStompBattle as all your allies come rushing in for one BigDamnHeroes moment after the other.
* ''Franchise/{{Halo}}'':
** At the end of ''VideoGame/{{Halo 2}}'' and the middle of ''VideoGame/{{Halo 3}}'', the Halos were activated and charging, and just a few minutes from firing and killing all life in the galaxy just before the heroes could push the off switch.
** At the end of ''VideoGame/{{Halo 4}}'', the Didact's ship is already in position to annihilate all life on Earth (in fact, he's already taken out one city) when Chief and Cortana are finally able to stop him.
* The first ''Franchise/MassEffect'' game had you racing against time to stop Saren and Sovereign from opening the [[spoiler: secret Mass Relay built into the Citadel to let the Reaper fleet through and begin the massacre of all sentient life in the galaxy.]]
** However, it's clear that the invasion is ''still'' coming and Shepard's actions have, at most, merely delayed it. This is proved true in ''The Arrival'' when Shepard is forced to [[spoiler: destroy a Mass Relay and an entire inhabited solar system]] to buy the Galaxy some time. It turns out this was only several months, as the invasion finally happens in ''VideoGame/MassEffect3''.
** Cerberus comes ''very'' close to pulling off this and a TeamRocketWins in the third game, by going on the offensive and repeatedly hampering everyone's attempts to combat the Reapers effectively. Eventually the Alliance is forced to perform an all-out assault [[spoiler: after they steal crucial information needed to finish the Crucible.]]
* ''VideoGame/KingsQuest'':
** The second Air Gem test in the FanRemake of ''VideoGame/KingsQuestII''. The canonical games glossed over this point, but the kingdom is in ruins, the hero's kids have been condemned to death, and the hero himself is close to breaking... then in walks the BigBad offering a DealWithTheDevil.
** Canonical ones in the series: walking into the wedding hall in VideoGame/KingsQuestVI to see "Cassima" enthusiastically declaring her intent to marry the GrandVizier. And in ''VideoGame/KingsQuestIV'' when Lolotte nastily declares that Rosella will have the StandardHeroReward of marrying her grotesque "son" [[spoiler: turns out he's just a prisoner, too]], strips Rosella of all her possessions, and locks her up.
* In the ''VideoGame/SpaceQuest'' series: Roger is captured by Vohaul in ''VideoGame/SpaceQuestIIVohaulsRevenge'', shrunken down to miniature size, and shoved in a jar while Vohaul readies the launch of his clone army of life insurance salesmen. In ''VideoGame/{{Space Quest V|The Next Mutation}}'', Roger is stranded on the bridge of the Goliath, surrounded by Pukoids, and the ship's heading for Confederation space, ready to spread TheCorruption to all of known space. If you prepared for this, then WD-40 and Cliffy show up for a BigDamnHeroes moment. ''VideoGame/{{Space Quest VI|Roger Wilco in the Spinal Frontier}}'' isn't as dramatic, but it is sad. After the BigBad tried to kill Roger, Stellar shows up and pulls a HeroicSacrifice. He can only bang on the door helplessly as she appears to succumb to the gas. Worse, Sharpei is going to get away with it because [[ScrewTheRulesIHaveConnections she is the wealthy and well-connected widow of a famous admiral]] while Roger and Stellar are "just" a janitor and soldier.
* ''Franchise/{{Pokemon}}'' had been slowly hedging in that direction for a while with the villains of ''Ruby/Sapphire/Emerald'' and ''Diamond/Pearl/Platinum'' coming ever closer to their goals. In Black and White, the bad guys [[spoiler:got their legendary]]. [[spoiler:They proceed to defeat the league champion]], leaving them with the firepower and the moral authority to get the region [[spoiler:to release their Pokémon]]. In their castle ([[spoiler:which has risen from the ground to surround the Elite Four headquarter]]), scientists are [[spoiler:hacking into the Pokémon storage system]], elevating them to global threat. And while [[spoiler: N]] wishes to face you in a one on one battle first, the Sages are a little more pragmatic [[spoiler: and intend to take you six on one and quite likely kill you before you make it that far]]. If you do, [[spoiler: you still don't have, or don't know where to find, the opposite legendary, which might even the odds a little in that battle. You have the stone to awaken him, but no idea where or how to use it]]. Then [[spoiler: your childhood friend Bianca rounds up the gym leaders of Unova who hold off the sages, and the stone you've been carrying all along ends up working at the last minute.]] The rest is up to you.
** In ''VideoGame/PokemonDiamondAndPearl'', Cyrus arguably comes even closer than Ghetsis. Even if N had beaten the player character, that wouldn't necessarily have handed him the region since there are plenty of other strong trainers about (particularly Cynthia) and there's the very real possibility that N would have worked out what was going on and stopped Ghetsis personally. Throughout Diamond, Pearl and Platinum, you fail to stop any of Galactic's Commanders or Cyrus even once, up to and including when you reach Spear Pillar, where only a major Deus Ex Machina stops Cyrus' total victory.
** In ''VideoGame/PokemonSunAndMoon'', [[spoiler: Lusamine momentarily succeeds in her plan by finally traveling to the [[EldritchLocation Ultra Beast dimension]] and likewise unleashing the [[EldritchAbomination Ultra Beasts]] onto the world. With the only hope that the heroes can prevent this is a vague rumor that the island's Legendary Pokemon lies beyond a vast and trecherous canyon. Fortunately the Pokemon that Lillie has been hiding in her bag the entire time turns out to be the pre-evolution to such a Legendary Pokemon]].
* ''VideoGame/CommandAndConquer'' had a few of these.
** To take the most telling example, Kane in ''VideoGame/CommandAndConquerTiberianSun'' was only three hours from launching his World Altering Missle when Mike [=McNeill=] arrived to the battlefield. Said missile would have converted all life on the planet into Tiberium-based life.
** In the meaningfully-named Allied mission "Last Chance" in ''VideoGame/CommandAndConquerRedAlert2'', the Soviets almost succeed in using a [[MindControlDevice Psychic Amplifier]] to mass mind control the entire United States.
** In the opening of ''Yuri's Revenge'', Yuri activates his [[DoomsdayDevice Psychic Dominator]] network, successfully mind controlling most of the planet. It's only due to one of them getting temporarily damaged that a time travel device the Allies built can be activated to undo Yuri's plan.
* In ''VideoGame/RuneScape'', Lucien has [[spoiler: completed the Ritual of Rejuvenation, sacrificing the weakest member of his species to recharge the powers of the rest, and he also has possession of the [[McGuffin Stone of Jas]]]], in his attempt to become AGodAmI. Them the [[spoiler: Dragonkin kill him.]]
* In ''VideoGame/NoMoreHeroes'', [[spoiler:Jeane]] managed to shove [[spoiler:her]] fist '''inside of Travis' heart''' and need only rip it out. Then enters [[spoiler:Shinobu, paying you back for sparing her life]], who then proceeds to cut the arm off as Travis goes for the finish.
* ''VideoGame/{{Okami}}'' eventually gets rather dire as [[spoiler:Yami]] has Ammy near death with her powers cut off and no help coming, but [[spoiler:Issun went through with his role of being the person who reminds the world of Ammy, allowing her to regain much of her lost power.]]
* In ''VideoGame/TheKingOfFighters '94'', if Kyo Kusanagi didn't assume the worst [[spoiler: when he saw his father unconscious after Rugal beat him to almost death]], he would have never [[spoiler: gone into an Unstoppable Rage-induced HeroicSecondWind and Rugal would have won.]] Kyo gets lucky for a second time in the next game [[spoiler: when Rugal's own power destroys him.]]
* In ''VideoGame/HyperdimensionNeptuniaV'', as early as ''Chapter 3'', Mr. Badd could have won against the three CPU goddesses without him having to lift a finger. The only flaw in his plan is an unknown fourth CPU goddess who was present at that time (and to be fair, Vert WAS being covert at that time, trying to observe Lowee's CPU).
* ''VideoGame/HyperdimensionNeptuniaMk2'' sets this up right for them start, with the [=CPUs=] having been defeated an imprisioned three years ago, and the heroes barely scraping together enough AppliedPhlebotinum to rescue one of them. The rest of the game is about turning things around.
* ''VideoGame/GhostTrick'' is about as damn near close as a story can come. [[spoiler:To wit: almost everyone is trapped underwater in the penultimate chapter. The submarine Lynne, Kamila, Sissel, and Missile's ghost are on is unsalvageable. Detective Jowd is elsewhere, dead in a room drifting to the bottom of the ocean. Commander Sith has plucked the Temisk fragment from Yomiel's body and is on his way back to his homeland. The only way the protagonists end up standing a chance is by launching Sissel and Missile's ghosts to Jowd's location via torpedo, rewinding back to Jowd's death, then rewinding ''back to Yomiel's "death" in Temisk Park ten years ago to finally SetRightWhatOnceWasWrong''.]] Essentially the timeline [[spoiler:that you left behind when Sissel was launched on the torpedo is [[DownerEnding completely doomed]] and you only save everyone by [[ResetButton rewriting history]].]]
* By the end of the first ''VideoGame/{{Robopon}}'', Dr. Zero has completed his revenge on Prince Tail, imprisoned Princess Darcy, and controls everything on Porombo Island. Cody is the only one that's able to stop him at all.
* In ''VideoGame/YuGiOhReshefOfDestruction'', both Reshef and Bandit Keith come very close to winning; Keith loses because the Winged Dragon of Ra refused to awaken for him and fried him with lightning when he forced you to hand Slifer over. Reshef only loses because Yugi, Joey, and Kaiba team up and weaken him to the point where he's barely beatable. Even after you win, he then tries to take over Pegasus completely and almost succeeds anyway.
* BigBad Raul Menendez of ''VideoGame/CallOfDutyBlackOpsII'' is the epiphany of this trope. [[spoiler: After witnessing [[DarkAndTroubledPast the death of his parents in his childhood]] and finally, the loss of his daughter at the hands of Frank Woods, Raul plots a plan that almost entirely kills not just the JSOC, but the ''entire'' US. He literally had the US at their mercy, and if it wasn't for Section, then chances are that Cordis Die could have ravaged the world.]]
* In ''VideoGame/TheElderScrollsIVOblivion'', [[TheDragon Mankar]] [[TheHeavy Camoran]] and his [[ApocalypseCult Mythic Dawn cult]] are defeated just prior to the climax of the game, though they succeed in their ultimate goal of summoning [[BigBad Mehrunes Dagon]], the [[OurGodsAreDifferent Daedric Prince]] of [[DestroyerDeity Destruction]], to the mortal world at full power. With Dagon [[AttackOfTheFiftyFootWhatever towering over the Imperial City]], it appears that all hope has been lost for mortal-kind. Then, [[spoiler:Martin performs a HeroicSacrifice, shattering the [[OnlyTheChosenMayWield Amulet of Kings]] to become an avatar of [[TopGod Akatosh]]. Martin/Akatosh banishes Dagon, saving the world, but [[BittersweetEnding takes the life of the last in the Septim line]] in the process]].

* During the "Holiday Wars" arc in ''Webcomic/SluggyFreelance'', Bun-Bun actually succeeds in killing all the major holiday figures and acquiring their power. He's poised to take over the world and rewrite reality in his image, and the only MacGuffin that can return things to normal is in his possession. It takes two [[TheChessmaster Chessmasters]] [[ThanatosGambit using their own deaths]] to launch a last minute [[ThePlan day saving plan]], as well as Bun-Bun's LivingShadow being a UnwittingPawn, to take him down.
* Deliberately invoked in ''Webcomic/TheOrderOfTheStick'' by Tarquin. He's a GenreSavvy believer in the TheoryOfNarrativeCausality. He thus takes heart in the fact that while TheGoodGuysAlwaysWin (maybe), they tend to win against a bad guy who was so powerful and reigned for so long no one thought he could be beaten. And Tarquin is fine with being defeated in the end in exchange for being an all powerful despot for a few decades before it happens. So he's already won, and gets to keep on winning and getting more powerful unless/until somebody beats him.
** On top of that, his Good-aligned son is the most likely to take him down, which plays right into his plan to ''keep on winning'' by becoming part of a legendary struggle of good vs. evil, so he can inspire generations of new villains with his example of how to live the good life. Unfortunately for him, [[spoiler:Elan is GenreSavvy enough to know that's what he wants, and after destroying Tarquin's power base, he abandons his father in a desert with enough supplies to escape - the story ends not with a triumphant final battle, but with the villain humiliatingly tossed aside like nothing.]]
* ''Webcomic/TowerOfGod'': [[spoiler: [[ArcVillain Kim Lurker]]]] nearly wins the Room Game by killing [[spoiler: SacrificialLamb Nia]], hypnotizing Yeon and stealing Wangnan's room, so that all that is left for him to win is to take [[spoiler: Prince]]'s room, who is currently locked in there with the [[spoiler: [[TurnCoat traitorous Rapdevil]]]]. Then Wangnan somehow manages to win [[spoiler: [[EvilerThanThou Viole]]]] [[GreyAndGrayMorality for his cause]], who simply curb stomps the villain's team.

[[folder:Western Animation]]
* This happens several times in ''WesternAnimation/JackieChanAdventures'', at the end of each [[MythArc seasonal storyline]]. For most of the season, the heroes keep beating the villains to whatever the [[MacGuffin magical artifact of the week]] is, thus negating their evil plans... until the last episode, in which the villains somehow get their hands on all of the artifacts (or otherwise win with a successful backup plan) which brings them very close to breaking free and achieving [[TakeOverTheWorld global domination]], until they're finally [[SealedEvilInACan defeated and banished/imprisoned for good]].
* In the made-for-TV WesternAnimation/FelixTheCat cartoons, while Professor and Rock Bottom [[TheGoodGuysAlwaysWin never earned a true victory over Felix]], they've come pretty close on occasion. In "Oil and Indians Don't Mix", Professor and Rock Bottom succeed in setting up an Oil Rig near Felix's diner and strike black gold, but the subsequent spout of it is so strong, that they're sent flying helplessly in the air, unable to claim Felix's oil. In "Felix's Gold Mine", Professor and Rock Bottom nearly win out over Felix, only to their plan to be foiled by a Deus ex Machina (namely, two birds that abruptly show up and carry them away, causing them to drop their money in surprise).
** In "Master Cylinder Captures Poindexter", Master Cylinder comes dangerously close in his goal of destroying the Earth with a meteor. Felix only narrowly averts disaster by breaking free of Cylinder's trap and using Poindexter's spaceship to drag and fling the meteor into the moon, where it harmlessly explodes on impact.
* [[EvilOverlord The Supreme One]] Shego from ''[[TheMovie A Sitch in Time]]'' of ''WesternAnimation/KimPossible'' had every hero captured and was finishing them off, when [[TheDragon Dr. Drakken]] got her to do some EvilGloating. Would be a great idea, if it didn't trigger [[YouSuck Ron Stoppable's]] BerserkButton.
** Drakken had a near victory in ''So the Drama'' with his Diablos scheme. However, when even [[TenMinuteRetirement the hero had lost hope]], the sidekick [[SugarWiki/HeartwarmingMoments confessed his feelings to her]], bringing the hero's fighting spirit back, and they discovered that [[PlotInducedStupidity Shego had forgotten about the naked mole rat...again]].
*** Worse, Shego LEFT THE FREAKIN' BACKPACK with ALL of the gadgets IN THAT VERY ROOM!
** The AlienInvasion in the GrandFinale probably counts as well. It may actually be the closest in the series the world came to ending.
* Nox, the BigBad from ''WesternAnimation/{{Wakfu}}'', seeks to [[spoiler: travel back in time to save the family he had failed 200 years prior to the show, an act which would also undo all of the myriad of atrocities he had committed up until that point in the pursuit of that goal. Despite the heroes' efforts he successfully drains the Sadida's Tree of Life, resulting in the death of their entire race, in a bid to power an ancient artifact that he believes will allow him to turn back time.]] In the final battle between him and TheHero, Yugo, [[spoiler: it looks for a moment as if Yugo is going to win. However, Nox uses a momentary distraction to kill (well, maybe knock out, since he does the same thing to Yugo's dad in the second episode, and he lived) Yugo. With TheHero dead, Nox uses all the energy he had collected over the last 200 years to travel back in time. Unfortunately for Nox, that is barely even enough to travel back in time ''20 minutes''.]] In a bit of a twist [[spoiler: the ending might actually have been happier if it had been a complete villain victory instead of merely a NearVillainVictory]].
* This happens ''three times'' in ''WesternAnimation/AvatarTheLastAirbender'': [[spoiler: the Fire Nation ultimately wins the war at the end of the second season when Princess Azula conquers Ba Sing Se, forcing Aang and his friends into hiding on enemy territory. Later in season 3, the few remaining pockets of resistance unite for a surprise counter-attack on the Fire Nation capital; it fails, costing the Avatar most of his remaining allies. At the end, with a super-charged Fire Lord Ozai preparing the killing blow against Aang, the Fire Nation's victory seemed irreversible until Aang regains access to the Avatar State and defeats Ozai.]]
* From the SequelSeries ''WesternAnimation/TheLegendOfKorra'', Amon comes within ''seconds'' of completing his plan, having [[spoiler:successfully robbed Korra of her powers and taken over Republic City]]. The ''only'' reasons he fails are beyond his control; namely [[spoiler:Korra suddenly being able to airbend]] and his own survival instincts.
** All of the [[ArcVillain Arc Villains]] in ''Korra'' come close to winning only to be defeated at the last second; Unalaq [[spoiler: merges with Vaatu, destroys Raava, and puts Republic City under siege,]] only for Korra to have a HeroicSecondWind and defeat him (with help from Jinora), Zaheer [[spoiler: successfully poisons Korra and wears her down to near death, but all his friends die, he's captured and Suyin is able to Bend the poison out of Korra's body]], and Kuvira captures Republic City [[spoiler: with her HumongousMecha superweapon]], but fails to kill Korra and gives the heroes enough time to rally and fight back.
* Occurs throughout the first season of ''WesternAnimation/{{Ben 10 Ultimate Alien}}''. Aggregor succefully manages to drain the powers of all four of the Adromega Galaxy aliens gather all four peices of the Map of Infinity and locates the Forge of Creation, where he intends to drain the powers of a baby Celestapian and be omnipotent. He defeats the members of Ben's Team and reaches to grab the baby, only to be suddenly stopped by once again mutated Kevin and is drained of the powers of the aliens he had absorbed knocking him out.
* Played with on ''WesternAnimation/ReBoot'': Megabyte takes advantage of the chaos during the Web invasion to get rid of Bob and cripple Mainframe's defense forces, but he's then imprisoned by Enzo at the start of the third season. Because the series follows Enzo's adventures in the Games after that, we don't know what happens to Mainframe until [[spoiler: he rescues Bob and finds a way home - only to find that Megabyte escaped and conquered the city a long time ago.]]
* ''[[WesternAnimation/AdventuresOfTheGalaxyRangers Galaxy Rangers]]'' episode "Shoot Out." The Queen has three Rangers in chains, displaying them like a trophy. The fourth is competing for his life in a BloodSport where the Queen's new champion has shot and wounded him. The animation where she's on her feet cheering while her captives look on in dismay is wonderfully done.
* ''WesternAnimation/{{The Powerpuff Girls}}'' has this in the episode "Knock It Off". The professor's old collegue, Dick Hardly, starts creating knockoffs of the girls to become rich and famous. He even defeats the original girls by draining them of their Chemical X. And if the knockoffs hadn't realized his cruelty and betrayed him, he would have definetly got away with it.
** In "Stray Bullet," Mojo Jojo irrevocably traps the girls and almost succeeds in destroying them until the little squirrel that Bubbles nursed to health with Chemical X shows up and kicks his butt.
* ''Anime/TransformersCybertron'' uses this. [[spoiler: [[BigBad Galvatron]] has the {{MacGuffin}}s in his hands. He knocks out ''[[PhysicalGod Primus himself]]'', and is on the verge of achieving his desire of [[AGodAmI godhood]]. The universe is minutes from being consumed by the Unicron Singularity, leaving Galvatron to remake things in his own image. The Autobot leaders - Optimus Prime, Override, Scourge, Evac, and Metroplex - manage to kick his aft by combining their Cyber Key attacks (leading to him having the following OhCrap moment: "[[GoshDangItToHeck Uh-oh.]]", which works beautifully as delivered by Creator/DavidKaye). But he's not through yet. Galvatron, in a last act of spite, pitches the Omega Lock and Cyber Planet Keys into the Unicron Singularity. If he can't win, nobody will. But even this fails. Override, Scourge, Evac, and Metroplex recover the keys, and Optimus Prime snatches the lock back from the jaws of the event horizon. The lock and keys couple to Primus' body, fully reconnecting his spark and bringing him back to full power. He uses the massive starship ''Ark'' to channel his power as a WaveMotionGun, firing it at the Unicron Singularity. The unnatural black hole of doom shudders, contorts, and disappears.]] His work done for now, Primus transforms back into Cybertron. But not as it had been, chewed up by the hell of war. It is reborn as a paradise for humans and Transformers alike. Just goes to show, the closer to ultimate victory you are, the harder you fall when it's snatched away.
** But there's still more. In the next episode, it's the FinalBattle. [[spoiler: Optimus Prime versus Galvatron, to the death. Galvatron has Optimus knocked flat on the ground, face in the dirt of one of Cybertron's moons. As he brings his sword down for the killing blow, Vector Prime uses the planet map (his last physical link to the linear universe) to block Galvatron's blade as well as give Optimus Prime his sword Rhisling. Optimus uses it, combined with the power of the Matrix of Leadership, to [[ImpaledWithExtremePrejudice skewer Galvatron]], killing him. Galvatron gives his fitting FamousLastWords FinalSpeech: "[[WesternAnimation/TransformersTheMovie I still function]]... you haven't... won... not while my... spark... still burns... [[EvilLaugh ha ha ha ha ha ha...]]" before crumbling to ashes that are swept away by the lunar winds. ]]
* ''WesternAnimation/TheTransformers'': The plot of "Megatron's Master Plan".
** And the last 3 episodes in "Rebirth".
* ''WesternAnimation/BeastWars'' Megatron has been just a hair away from victory ''three times.'' [[spoiler: The first time, he nearly erased the Maximals from existance by killing Optimus Prime four million years before he woke up. The second was when he found the repaired Nemesis and tried to use it to kill the Autobots still offline in the Ark. The third time he absorbed nearly all the sparks on Cybertron, became a god, and tried to remake Cybertron in his own image.]]
* Happened alot in ''WesternAnimation/TotallySpies'', such as the second episode, "The New Jerry", with the Spies trapped in a space capsule and Tim Scam firing on the Earth with the Evapo-Blaster.
* ''WesternAnimation/MyLittlePonyFriendshipIsMagic'':
** It happened in the very first episode of the very first season. Nightmare Moon popped up, carried out her plan, removed her sister, set her traps, destroyed the Elements of Harmony...except that last step turned out to have failed.
** Happens in "The Return Of Harmony". [[spoiler:Discord has [[BreakTheCutie emotionally broken]] and MindRaped five of the Mane Cast already to the point the Elements Of Harmony -- the ''only'' magic that can defeat him -- are useless and driven Twilight Sparkle across the DespairEventHorizon, completely shattering the mane cast's friendship. With the heroes crushed and beaten, Discord takes over Equestria, transforming it into a surreal WorldGoneMad that's growing more chaotic by the moment, with Ponyville as his new "chaos capital of the world". However, his victory is snatched away from his grasp when Celestia [[BatmanGambit sends Twilight all the letters her student had sent her over the last season,]] which restores Twilight's hope and motivates her to restore her friends to normal. Reunited, the group confront Discord and [[HoistByHisOwnPetard his own pride and belief the Elements of Harmony won't work]] causes him not to realize this until its too late. Discord [[SealedEvilInACan is sealed away]] and a WorldHealingWave created by the Elements of Harmony restores Equestria to normal.]]
** Happens again in the Season 2 finale. [[spoiler:The Changeling Queen has destroyed the barrier protecting Canterlot, unleashed her hordes upon the city to feed off the love of all the ponies, and has even defeated Celestia in a straight-up fight by tapping into Shining Armor's love for Cadence. Even worse, the Mane 6 fail to reach the Elements of Harmony in time, and are captured by the thousands of changelings that now storm the city. Unfortunately for the queen, she forgot that Cadence and Shining Armor are still in the room, ''and'' that Cadence's magic is [[HeartIsAnAwesomePower the ability to make ponies love each other.]] The result is Shining Armor getting a massive injection of the PowerOfLove, which gives him enough power to reset the barrier and blast all of the changelings out of Canterlot once and for all.]]
** The Season 3 two parter also has this happen, with a twist. King Sombra's near victory is the result of his actions [[CrazyPrepared taken before the story even starts]]. [[spoiler:Cadence's magic gives out, causing the barrier keeping Sombra locked out to fail and Sombra himself to enter the Crystal Empire. Twilight ends up trapped by a crystal barrier, which also begins to corrupt the Empire from the inside and prevents her from getting the Crystal Heart where it needs to be defeat Sombra. Spike manages to get the Crystal Heart and try to get it to where it can defeat Sombra, but Sombra attacks, coming within a few inches of capturing or possibly ''killing'' him before Shining Armor [[FastBallSpecial throws Cadence like a javelin to catch Spike and the Heart]], allowing them to power it up and kill King Sombra.]]
** "[[Recap/MyLittlePonyFriendshipIsMagicS4E26TwilightsKingdomPart2 Twilight's Kingdom, Part 2]]", [[spoiler:Tirek claiming Discord's magic and all the magic Twilight had been carrying with her means he had technically ''won''. There wasn't a creature alive in Equestria with enough magic to constrain him at that point. So the team has to tap into an EleventhHourSuperpower to break through.]]
** In "[[Recap/MyLittlePonyFriendshipIsMagicS5E1TheCutieMapPart1 The Cutie Map]]", [[spoiler:Starlight Glimmer is only defeated thanks to three chance reasons: The ponies get ''lucky'' and expose her fake cutie mark, the townsponies (who willingly followed her philosophy to begin with) decided to turn on her rather than accept her well-justified reason for keeping her own cutie mark, and those random villagers managed to (just barely) stop Starlight before she escaped. This is probably the closest the [[FanNickname Mane 6]] ever came to utter defeat, and that is saying a ''lot''.]]
** It's only made worse in the Season 6 finale, "[[Recap/MyLittlePonyFriendshipIsMagicS6E25ToWhereAndBackAgainPart1 To Where and Back Again]]", [[spoiler:as within the span of a few hours that Starlight Glimmer was out of Ponyville visiting her old village with Trixie, Queen Chrysalis and her Changelings, in both another invasion attempt on Equestria and {{Revenge}} on the Royal Family and Elements of Harmony for her previous defeat at the [[Recap/MyLittlePonyFriendshipIsMagicS2E26ACanterlotWeddingPart2 Royal Wedding]], have managed to sweep into the country and kidnap all of them without being discovered, replacing all of them with fakes. Every Alicorn Princess, Shining Armor, Spike, and the Mane Six, have been taken back to Chrysalis' hive to be kept prisoner in cocoons, with their magic inaccessible due to Chrysalis' [[AntiMagic throne]], leaving it up to Starlight, Trixie, Discord, and Thorax to mount a rescue attempt that ultimately fails. That is, until Starlight convinces Thorax to willingly give Chrysalis his love energy, sending her flying into her throne and cracking it. This causes Chrysalis' own Swarm to turn on her, and the resulting surge of love energy ends up destroying her throne and throne room, frees her prisoners from their cocoons as the throne room's destruction caused the cocoons to fall and break open, and with her sorely outnumbered by the Royal Family, Elements of Harmony, Master of Chaos, her reformed Swarm, and their new leader, King Thorax, Chrysalis has no choice but to retreat in utter defeat, but not without swearing a new vendetta against Starlight for taking everything away from her.]]
** Twice in the made-for-[=TV=] movie, ''WesternAnimation/MyLittlePonyEquestriaGirlsRainbowRocks''. First, the Hu-Mane Six are sent down a {{trapdoor}} and LockedInARoom under the stage, and the negative energy produced by their argument begins to give the Dazzlings more power than they dreamed of, but Sunset Shimmer snaps them out of it and Spike fetches [[ChekhovsGunman DJ PON-3]] to unlock the door. Second, during the final battle, the Dazzlings' siren avatars initially overpower the Rainbooms, knocking the mic from Twilight's hands, but Sunset grabs it and joins the band along with DJ PON-3 providing a beat, allowing them to summon their own alicorn avatar and turn the tide.
* In the ''WesternAnimation/SupermanTheAnimatedSeries'' episode, World's Finest, ComicBook/TheJoker comes to Metropolis with an enormous amount of kryptonite to make a deal with Lex Luthor to kill Superman. Both Luthor and Superman severely underestimate the Joker as just some wacky clown, [[NotSoHarmlessVillain until the Joker traps Superman in a room with acid and half of the kryptonite.]] By the end, the Joker is dancing over Superman's nearly lifeless body and is only stopped by Batman's timely intervention, a man who Luthor and Superman also underestimated.
* In the series finale for ''[[WesternAnimation/JusticeLeague Justice League Unlimited]]'', {{ComicBook/Darkseid}} delivers an utter asskicking on Superman for almost the entire episode and constantly taunts him about how he's going to win. Even after Superman's WorldOfCardboardSpeech and awesome MegatonPunch, [[GeniusBruiser Darkseid immediately turns the tide back into his favor by simply changing tactics]] activating an Agony Matrix that leaves Superman completely helpless. As Darkseid pulls out a kryptonite knife to carve out Superman's heart for a trophy ([[WhatDoYouMeanItsForKids and yes, this is a kids' show]]), ComicBook/LexLuthor shows up with the Anti-Life Equation. For those who know the lore behind Darkseid and the New Gods, they know why this affects the outcome.
* At the end of the ''WesternAnimation/SpongebobSquarepants'' episode "Frozen Face-Off" this happens to Plankton, then the snow monster confuses him for a jellybean.
* Lord Darkar from ''WesternAnimation/WinxClub'' was seconds from obtaining the power of the Realix and securing his victory when Bloom managed to break free from his control and hijacked the Realix power.
* Dick Dastardly appeared to have won the race in the ''WesternAnimation/WackyRaces'' episode "Creepy Trip To Lemon Twist," until the judges ask to see a slow-motion replay. It shows Dastardly extending the nose of his car ahead of the other racers. He is disqualified and the race awarded to Penelope Pitstop.
* In the first part of the ''WesternAnimation/GravityFalls'' series finale "Weirdmageddon", Bill Cipher escapes from his Nightmare Realm and takes over Gravity Falls, turning it into his personal WorldOfChaos. Over the next two parts, Dipper Pines rallies his friends and family against Bill and his demon army, and despite [[spoiler: [[HopeSpot a few close calls]] and Grunkle Stan having his memories temporarily erased to destroy Bill once and for all]], [[EarnYourHappyEnding everything ends fairly happily]].
* ''WesternAnimation/SamuraiJack''; [[spoiler: in the penultimate episode, Aku forcibly turns Ashi into a HumanoidAbomination and Jack, unwilling to kill the woman he loves, surrenders to his nemesis. The finale opens with Aku broadcasting Jack's capture and pending execution to the world, but he wastes enough time waffling over how to kill the samurai that Jack's allies launch a counterattack to save him. This in turn gives Jack a chance to break free, snap Ashi out of her brainwashing, and get back to the past to destroy Aku once and for all.]]
* ''WesternAnimation/WanderOverYonder'': [[spoiler: By the end of the second season, Lord Dominator had succeeded in destroying ''the entire galaxy'', except for a Secret Planet she knew nothing about.]]