Eucatastrophe

"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. I'm just increasingly uncomfortable about our place in the narrative structure of this war.""

- That Mitchell and Webb Sound, in which two Nazis start worrying that they might actually be the bad guys

All hope is lost, soon the Big Bad will achieve his/her goal of taking over/destroying the city/world/universe and there's nothing the heroes can do to stop them. 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 99% 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. 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. 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 Evil Overlord, confident they've got nothing to worry about. This gives the heroes the opening to make a big, crippling blow when the Big Bad is least expecting it.

Note: There is in fact a very real and very specific word for this trope. That word is eucatastrophe. (It's also worthwhile to note who invented this word. Though JRR Tolkien'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 Hope Spot.

Compare You Can't Thwart Stage One. Might overlap with Darkest Hour. Often used to set up a plot about coming Back From the Brink when it occurs in video games. If it gets bad enough, then Only the Author Can Save Them Now. In video games, the Instant Win Condition can easily result in this trope.

Anime and Manga

 * Occurs in the Cell Saga of Dragonball Z, when Big Bad Cell who was thought to have died when he self-destructed comes back thanks to his regeneration From a Single Cell 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 Beam-O-War struggle which he is slowly losing ground in. 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 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 Crowning Moment of Awesome; 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 Villain Decay (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 an entirely 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 Blood Knight 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... at which point Broly goes Super Saiyan 2. And proceeds to No Sell pretty much anything Gohan throws at him. He reacts a little bit to being drowned IN LAVA. The following is possibly the most intimidating Out of the Inferno ever. Because, y'know, LAVA. The Gohan / Spirit Form Goku team Kamehameha from the Cell arc? Yeah, that's how they take Broly down for the count. With Spirit Goku, Gohan, and Goten, Goku's other son.
 * Mazinger Z: 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  That story was greatly expanded in the Mazinger vs Great General of Darkness movie.
 * Great Mazinger: 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, and attacked Mazinger-Z and Great Mazinger separately. Kouji and Tetsuya nearly got killed, and The generals of the Mykene army laughed. Five minutes later they were not laughing.
 * UFO Robo Grendizer: One of the best examples happened in the two-part finale of the first season. Grendizer had been beaten by two Robeasts and forced to hiding, Kouji's TFO had been badly damaged, Blackie had taken control of the Science Space Center and tortured Dr. Umon. When Duke returned,
 * Occurs in all five of the final battles of Sailor Moon
 * It's an unwritten rule in Yu-Gi-Oh! and its spinoffs that the protagonist can't win with more than 500 Life Points.
 * Sometimes subverted or outright averted, most notably in 5Ds, when Badass Normal Crow wipes the floor with some security guards in about one turn. Also, Yusei, so the above rule might remain unwritten.
 * But Crow plays Blackfeathers...
 * ...Wait, why are security guards playing Duel Monsters?
 * "This is Japan, Mokuba. Card Games are the ONLY LAW."
 * 5Ds had quite a few Near Villain Victories at the start of the Dark Signer arc - mostly due to the Jibakushin. On two occasions, the protagonists only survived due to timely Plot Driven Breakdowns.
 * The "Waking The Dragons" filler arc also had Yugi win his first duel of the season with 1000 Life Points left.
 * ROD the TV. 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.
 * Twentieth Century Boys uses this to great effect. Friend, for one, . It's only when, that things start to turn in our heroes favor.
 * Monster has one at the end when, following the Ruhenheim Massacre,.
 * The goal of the bad guys in Digimon Frontier is to destroy the digital world piece by piece and feed it to Lucemon, thereby 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.
 * Digimon Xros Wars does it twice. First it seems DarkKinghtmone 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,.
 * Oh good Lord, Fullmetal Alchemist. In Chapter 104, Luckily for the world,  At which point awesomeness ensued.
 * Tokyo Majin. The heroes are up against a God Mode evil spirit (Yagyu Munetaka) who eliminates pretty much 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.
 * In Pokémon: Zoroark: Master of Illusions, Big Bad Kodai almost succeeded in opening the Time Ripple....
 * Also, in the TV special Mewtwo Returns, Giovanni came very close to success.
 * In Project ARMS, 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.
 * In Bleach, Aizen has, beaten the Court Guard Squads, killed  , and is just about to kill Ichigo's friends and take over the universe when Ichigo arrives as a   and
 * Gundam ZZ: Neo-Zeon is pretty much in total control for the entire 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 Enemy Civil War erupts and Neo-Zeon rips itself apart, allowing the Federation's previously-outmatched forces to come in and sweep up the pieces.

Comicbooks

 * Classic Marvel tale where Kang The Conqueror realizes that all he needs to defeat the Avengers is to get a 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 Iron Man is. On the rescue mission the robot systematically separates and takes out all the Avengers, but before he can finish them off 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, Spider-man's clone happened to be in the area.
 * This trope seems to be very common for Kang; in the "Kang Dynasty" storyline,

Fairy Tales

 * The Black Bull of Norroway is the example of eucatastrophe cited by Tolkien in his "On Fairy Tales": 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.

Fan Fic

 * All three of Trigger Happy Fanboy's Pokemon fanfics have these. And considering the fact that they're all in the same universe, they live in a pretty deadly world.
 * In Dance of Destiny: 's subordinate, Dialga, has Celebi immobilized between dimensions, Darkrai is beaten into the ground by Zapdos, Moltres, and Articuno, Tianna is unconscious, and Axel is about to be eaten by the said Big Bad. Cue   to fly in and engage   in battle. Axel
 * In the Forget Shipping duology (Let The Flames Begin/And Watch Cities Burn)
 * Blood in The Water has the biggest Near Villain Victory 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 Olympous Mons, and there is pretty much no way to win.

Films -- Animated

 * Scar from The Lion King takes this trope farther than most, as he not only succeeds in taking over Pride Rock, but actually holds onto this position for several years (despite a Zero-Percent Approval Rating) until Simba returns.
 * And he almost won there as well. The only reason he didn't is because his Fatal Flaw, Pride, came in as he decided to let Simba in on "a little secret" before killing him leading to Simba's Unstoppable Rage.
 * Jafar comes disturbingly close to triumphing over Aladdin. Once again in the sequel.
 * Mozenrath keeps the tradition alive in the series.
 * In Turtles Forever, 2003 Shredder nearly manages to kill the Original Comic Turtles, nearly destroying every single universe, until he's done in by  and

Films -- Live-Action

 * The final battle over Area 51 in Independence Day.
 * Done so very masterfully in Star Trek II the Wrath of Khan with the countdown to the Genesis detonation.
 * Also done masterfully in the new Star Trek, where the Ax Crazy 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 Big Damn Heroes moment.
 * Probably one of the best-known examples is in Star Wars Episode IV: A New Hope. The Death Star is about to blow up Yavin IV and the Rebel Alliance with it, their X-wing squad sent to destroy it have all been eliminated except for Luke Skywalker, who at the moment is about to be shot down by Darth Vader, when the Millennium Falcon appears out of nowhere, knocking Vader's TIE fighter into space and allowing Luke to fire the shot to blow it up.
 * Also, the Battle of Endor in Return of the Jedi 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 given in to his anger and tried to kill Palpatine, only to be stopped by Vader...
 * Also, moments before Darth Maul's unlikely demise, Obi-Wan Kenobi was dangling from a wall fixture inside a bottomless pit, with Maul about to make a killing stroke.
 * Count Dooku has the surviving Jedi on Geonosis trapped before the Republican gunships arrive.
 * The Dark Knight manages to bring everyone to the brink of chaos and oblivion before a combo Crowning Moment of Heartwarming, Crowning Moment of Awesome, and Big Damn Heroes, as well as a pretty hefty personal sacrifice made by Batman himself.

Literature

 * JRR Tolkien not only loved this trope - it appears throughout his books - he named it. He coined the word "eucatastrophe" himself, and he identified it as the typical ending to what he called "Fairy Stories". 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 Back From the Dead. Some examples of it in his own work:
 * The Silmarillion: The final overthrow of Morgoth by the Valar, in response to the plea of Eärendil and Elwing.
 * The Hobbit: The Battle of Five Armies, saved by the arrival of the Eagles.
 * The Fellowship of the Ring: The near-capture of Frodo by the Ringwraiths at the Ford of Bruinen.
 * The Two Towers: Gandalf's arrival at Helm's Deep.
 * 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, which turns everything around by killing Sauron, which also confuses his armies, which allows Aragorn & co to win.
 * Harry Potter, which JRR Tolkien would probably classify as one such "Fairy Story", has tendencies in that direction.
 * Most obviously in The Deathly Hallows: has just tried to defy Voldemort, and is getting tortured . 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, of course
 * It's not quite as simple as the spoiler describes. However, the nature of the eucatastrophe is spelled out in black and white in, in which he describes in detail exactly how the pieces have been falling into place to is the product of him realizing what the pieces are and how they've fallen into place.
 * Arguably played straighter earlier on in the book, when Voldemort overthrows the Ministry via his brainwashed pawn, starts having Mugglborns rounded up to be de-souled, and spreads the word that Harry was actually Dumbledore's murderer, thus getting a ton of people to persecute his most hated enemy. A good chunk of the book is Harry, Ron, and Hermione desperately trying to continue their quest while hiding from spies and "Snatchers".
 * In Frederick Forsyth's The Day of the Jackal, the titular Villain Protagonist actually manages to get off a shot at Charles De Gaulle and miss before he is finally killed.
 * A Song of Ice and Fire 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. 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 Grey and Grey Morality and Black and Grey Morality.
 * In Warrior Cats, Scourge kills Firestar, and is about to defeat LionClan when
 * The Yeerks are just about always on the edge of victory throughout the entire Animorphs series.
 * In the Mistborn trilogy, Ruin very nearly manages to destroy the world before . Even so, the world would probably still have effectively died if   and fixed everything.
 * The Inheritancecycle 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. He had shown evidence of perhaps being a "Well Intentioned Extremist", and fans before had complained he did not seem evil, leading this troper to believe for the first time that a"Bad Guy Wins" ending that later turned out not be would happen. How this is managed showns great use of eucatastrophe.
 * The Wheel of Time 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. Xanatos Speed Chess 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

Live-Action TV
"Percy: My good fellow, I would never dream of depriving you of your moment of triumph. Alas, a moment was all I could spare."
 * The writers and producers of 24 have perfected this to such a degree that they should copyright this trope.
 * And even then the villains generally cause enough damage before they are defeated up to the point where the heroes simply won't get to celebrate.
 * Likewise, Star Trek is pretty adept at bringing our heroes to edge of disaster before they win the day.
 * The Borg in Star Trek: The Next Generation mop the floor with Starfleet, kidnap The Captain, 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 Star Trek: Enterprise 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 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 it's first defeat ever.
 * The best Buffy the Vampire Slayer 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 an ace in the hole, not something anyone really wanted to do unless they had to.
 * Seriously awesome when Buffy uses Willow's power and Giles' knowledge to turn missiles into doves.
 * Illyria of 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.
 * The Series 4 finale for the new Doctor Who has The scene itself and the leadup is pretty dark.
 * In Series 3, the Master actually succeeds in ruling Earth for 12 months.
 * 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 have got off scot-free.
 * In the Backstory to Babylon 5, 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 Lost,
 * This trope is common for Power Rangers as nearly every season has the Big Bad nearly winning despite the victories and upgrades that the rangers have gotten during the season. Though special mentions include...
 * Mighty Morphin Power Rangers - Rito Revolto 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 Power Rangers Zeo, the Rangers are able to turn the tide by retrieving the Crystal (which Goldar & Rito had dropped while teleporting) and gaining new powers.
 * Power Rangers in Space - 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
 * Power Rangers Lost Galaxy - After Trakeena's fusion with Deviot increased her evil, she launches a massive Sting winger attack on Terra Venture with all of the strapped with bombs. She succeeds in destroying 2 megazords and nearly wipes out the civilians evacuating the colony. The rangers use the 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 . 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.
 * Power Rangers Time Force - After, Ransik begins his final fight with the rangers, . 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 at a noise and accidentaly hits Nadira. Shocked he almost killed his daughter, he turns himself in.
 * Power Rangers Operation Overdrive - Not actually a season finale. However, when Thrax,, the rest of this season's villains destroy the ranger's 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
 * Power Rangers RPM - Not a season finale either, at first. The rangers are fighting against the computer virus Venjix to prevent him from taking over Corinth, . However when we begin the season he has already
 * Used magnificently in the Anthony Andrew's version of The Scarlet Pimpernel . The look on Chauvelin's face when he turns around and sees him standing there is absolutely priceless.

Music

 * In the Emerald Sword saga, near the end Big Bad Akron has destroyed and conquered almost all the cities of Algalord, is holding the Emerald Sword and is torturing The Hero and going to have him fed to water snakes.

Tabletop Games

 * This Magic: The Gathering card. The context is of fighting world-eating Eldritch Abominations and winning.

Videogames

 * The plot of the Ace Combat series revolves around this. the player is an ace pilot that acts as a tipping point in the war during gameplay. Where as the cut scenes revolve around the ramifications of the player's actions.
 * 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.
 * This is entirely because the cases Phoenix takes are invariably stacked against the defendant from the get-go, thanks to (possibly doctored) evidence and witness testimony. Considering the facts of his cases (see below), the fact that he manages to pull off anything at all is nothing short of astounding.
 * In the course of the series, Phoenix (deep breath):
 * 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 World Ends With You Kitanji has Neku at his mercy. His brilliant Evil Plan 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 Noise and are about to erase Neku when the Spanner in the Works sets in.
 * Soul Nomad had a few when you were fighting the World Eaters, Raksha especially seemed unstoppable
 * Final Fantasy IV. The Final Boss has effortlessly overpowered you. It seems like all hope is lost until....
 * Final Fantasy VI 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. The heroes manage to kill Kefka and save the world in the end, but for a while there, the villain did win.
 * Final Fantasy VII has Sephiroth's plan for Meteor to smash into the Planet almost succeed, even after his defeat. It's basically Divine Intervention that saves the day in the end.
 * Final Fantasy IX does this during a Hopeless Boss Fight.
 * Star Ocean the Second Story also deserves this mention:
 * The 2 Custom Robo games use this at their seemingly invincible final bosses. The DS's version's example is a lot like the FF 4 one.
 * Super Metroid has another example when you nearly die fighting the Final Boss.
 * As does Metroid Fusion.
 * Symphony of the Night 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 Foregone Victory.
 * There isn't a final boss from a Paper Mario game that doesn't do this. Super Mario RPG and Mario & Luigi are immune. So far.
 * Ganondorf in The Legend of Zelda: Ocarina of Time scores a fairly impressive victory during the first arc of the game -- he 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 change her gender cross dress in order to effectively hide from him, and The Hero is put in an enchanted sleep that will allow him to grow up sufficiently in order to put the kingdom back to rights.
 * In 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.
 * At one point in Super Smash Bros Brawl, every single playable character (and Master Hand) is dead (well, trophyified). Then Dedede's timed badges go off...
 * Fate/stay night, Heavens Feel. So many things go wrong that by the time you get to the end  makes things a bit easier
 * Mortal Kombat 3: 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 Ones who had their souls spared. He barely avoided victory, due to his underestimating the power and tenacity of his foes.
 * The Fallout series does this in every episode.
 * Fallout: while you are hunting for the Master and the Vats, the mutant army is on the doorstep of Vault 13.
 * 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.
 * 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 Kill Sat on the Citadel afterwards so it counts as two.
 * New Vegas 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 Curb Stomp Battle as all your allies come rushing in for one Big Damn Heroes moment after the other.
 * At the end of Halo 2 and the middle of 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.
 * The first Mass Effect game had you racing against time to stop Saren and Sovereign from opening the
 * Plus, there's still a Villain Victory in the cards, you just DELAYED it.
 * The second Air Gem test in the Fan Remake of King's Quest II. 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 Big Bad offering a Deal with the Devil.
 * Canonical ones in the series: walking into the wedding hall in King's Quest VI to see "Cassima" enthusiastically declaring her intent to marry the Grand Vizier. And in King's Quest IV when Lolotte nastily declares that Rosella will have the Standard Hero Reward of marrying her grotesque "son", strips Rosella of all her possessions, and locks her up.
 * In the Space Quest series : Roger is captured by Vohaul in Space Quest 2, shrunken down to miniature size, and shoved in a jar while Vohaul readies the launch of his clone army of life insurance salesmen. In Space Quest 5, Roger is stranded on the bridge of the Goliath, surrounded by Pukoids, and the ship's heading for Confederation space, ready to spread The Corruption to all of known space. If you prepared for this, then WD-40 and Cliffy show up for a Big Damn Heroes moment. Space Quest 6 isn't as dramatic, but it is sad. After the Big Bad tried to kill Roger, Stellar shows up and pulls a Heroic Sacrifice. 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 she is the wealthy and well-connected widow of a famous admiral while Roger and Stellar are "just" a janitor and soldier.
 * Pokémon 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 ., leaving them with the firepower and the moral authority to get the region  . In their castle ( , scientists are  , elevating them to global threat. And while   wishes to face you in a one on one battle first, the Sages are a little more pragmatic  . And even if you do,  . Then   The rest is up to you.
 * Command and Conquer had a few of these. To take the most telling example, Kane in Tiberian Sun was only three hours from launching his World Altering Missle when Mc Niel arrived to the battlefield. Said missle would have basically converted all life on the planet into Tiberium-based life.
 * Of course, whether Kane and the Brotherhood are 'evil' depends on one's point of view.
 * In Red Alert 2, the last Soviet mission is a desperate fight to destroy the Chronosphere in Alaska, before the Allies launch an invasion of Moscow.
 * On Runescape Lucien has, in his attempt to become A God Am I. Them the

Webcomics

 * During the "Holiday Wars" arc in Sluggy Freelance, 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 Chessmasters using their own deaths to launch a literally last minute day saving plan, as well as Bun-Bun's Living Shadow being a Unwitting Pawn, to take him down.

Western Animation

 * The Supreme One Shego from A Sitch in Time of Kim Possible had every hero captured and was just about finishing them off, when Dr. Drakken got her to do some Evil Gloating. Would be a great idea, if it didn't trigger Ron Stoppable's Berserk Button.
 * Drakken had a near victory in So the Drama with his Diablos scheme. However, when even the hero had lost hope, the sidekick confessed his feelings to her, bringing the hero's fighting spirit back, and they discovered that 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 Alien Invasion in the Grand Finale probably counts as well. It may actually be the closest in the series the world came to ending.
 * Nox, the Big Bad from Wakfu, seeks to  In the final battle between him and The Hero, Yugo,   In a bit of a twist.
 * This happens twice in Avatar: The Last Airbender:
 * Frankly,the whole premise of the show runs on this trope, the Fire Nation have pretty much won the war at the beginning,it isn't until Aang is rescued from the iceberg that any credible threat arrives
 * Played with on Re Boot: 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
 * 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 Blood Sport 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.
 * Transformers Cybertron uses this.  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 Final Battle.
 * Transformers Generation 1: The plot of Megatron's Master Plan.
 * And the last 3 episodes in "Rebirth".
 * Beast Wars Megatron has been just a hair away from victory three times.
 * Happened alot in Totally Spies, 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.
 * Happens in Season 2 of My Little Pony Friendship Is Magic "The Return Of Harmony".
 * Happens again in the Season 2 finale.
 * In the Superman: The Animated Series episode, World's Finest, The Joker 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, 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 Justice League Unlimited, 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 World of Cardboard Speech and awesome Megaton Punch, 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 (and yes, this is a kids' show), Lex Luthor 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.

Real Life

 * World War II would probably have looked like one at the time (to someone who hadn't studied the whole economics of the situation): by June 3, 1942, Japanese carriers were running all over the Pacific on a conquest spree, Britain was the only nation still fighting Hitler in Western Europe, the Soviets were giving ground before the German army, and Rommel was advancing across the African desert. Over the next six months, the Axis learned all about places named "Midway", "El Alamein" and "Stalingrad".
 * Similarly, the events of 1939-1940 that led to Hitler bowling over all opposition in Europe, except a small island (and a tiny part of another). Then came the German's first undisputed major defeat at the Battle of Britain.
 * Let's not forget the millions of dollars in weapons, munitions, food and other essential supplies that that "small island" had coming in from its estranged stepson across the pond.
 * Quite a few things worked for the Allies' favor though, such as their secret knowledge of the Enigma code, and the fact that they managed to capture or convert nearly every German agent on British soil.
 * There's one crucial operation that saved Britain right after France fell. While most people who have heard of WW 2 will know that Britain's navy was one of the strongest in the world they wouldn't realize the incredibly precarious position they were in. In May of 1940, Britain's Indian and Far East (Southeast Asia) fleets were busy guarding against the Japanese, the U.S. was Heroic Neutral, and Germany now had access to their own High Seas fleet, the Italian fleet, the French fleet, and it looked like they might gain access to Spain's ships and ports if Franco allied with Hitler openly. Britain's navy managed an amazing sneak attack wiping out the French fleet. This convinced Franco to not become an active ally to Hitler and the difference in naval strength and inability to use Spain as a launching zone convinced Hitler that an air attack against Britain would work best.
 * Amazing as it was it was also a huge Shoot the Dog moment considering the French sailors had been their allies merely weeks earlier and 1,300 of them were killed in the process. As much as the practical benefit it was also a display in front of the whole world about how strongly Britain was committed to fighting.
 * Then there's the Dunkirk evacuation. A series of Allied military blunders in May 1940 allowed the Germans to break through the French front lines and catch the Allied troops totally unprepared. The British army, in particular, was in a terrible defensive position at that moment. If General Guderian, the German commander who led the breakthrough, had been allowed to follow up his success, he could have swept north and rolled up the entire British army. Instead, his own CO chewed him out for taking "foolish risks", and Guderian resigned on the spot. He was persuaded to rescind his resignation and resume command, but several days had passed by that point, and the opportunity had been lost. Britain evacuated their soldiers from the continent in one of WWII's most awesome operations ever (only D-Day qualifies as more awesome than Dunkirk), and the war continued. But its still a stretch to say the Nazis came amazingly close to winning World War Two outright. If the Dunkirk evacuation had failed, the Battle of Britain would never even have been fought. The British would have politely packed up and said "Well! That's that then! Cheerio!"
 * Actually, there was a WW 2 Near Villain Victory that outclassed even Dunkirk: the Battle Off Samar. Part of one of, if not the largest naval battles in history, this battle was a total mismatch: the Japanese Center Force, a battle group comprised of dozens of heavy cruisers, destroyers, battleships, all of which was led by the largest battleships ever constructed, Yamato; the American task force, "Taffy 3", was just a support force made up entirely of ships known as "tin cans"--because they lacked any armor. Six light escort carriers, three light destroyers, and three destroyer escorts (these destroyers had a few torpedoes each, and between two to four 5 inch guns, whose shells would literally bounce off the hulls of the Japanese ships). Taffy 3 was taken completely by surprise, but responded quickly, throwing up a smoke screen with the light destroyers while the carriers launched all of their planes, in spite of the fact that none of them were equipped to fight ships--in many cases, they didn't even have any bullets, and would just fly straight at the bridges of enemy ships and look threatening. Then the captains of the light destroyers, of their own accord, charged straight at the Center Force, ignoring the fact that the many dozens of Japanese guns outranged theirs by miles. They closed the distance, launched torpedoes--their only effective weapon against the Japanese ships--and sank a few heavy cruisers. Then they continued forward, firing hundreds of five inch shells at the upper works of the heavy ships, whose armor-piercing shells went straight through the armorless light destroyers without doing much damage. Eventually, the light destroyers were pummeled to death, a carrier was critically damaged, and reinforcements were at least many hours away. Just as the Center Force was on the verge of total victory (which, on top of annihilating every American ship, meant that they could bombard the crap out of the American landing force and most of their supplies at Samar, which was critical), they turned around and retreated. What happened was the result of several unintentional bluffs and a single bad case of intel--the Center Force thought they were facing an entire American Fleet Carrier Battle Group, due to the smoke screen concealing the carriers from view, hundreds of American planes swarming the Center Force like crazy (and looking like they were dropping bombs or torpedoes, but were in reality fuel tanks or depth charges), light destroyers charging a vastly superior force without hesitation and actually sinking or heavily damaging many ships, and a Japanese intel report that an American fleet carrier force was supposed to be in the area at the time--causing the Japanese admiral to call for a withdrawal, believing that they could at best achieve a Phyric Victory, especially considering the incorrect Japanese belief that battleships were still roughly equal or even greater than carriers.
 * World War One had one that if anything looks even worse with the inclusion of economics, and it occurred pretty much at the tail end of the war in 1918. To wit: the entire Eastern front collapsed with the Bolshevik Revolution pulling Russia out of the war, forcing the surrender of Romania, and generally stranding any and all Allied forces in Eastern Europe in hostile territory (like the fate of the British Baltic sub fleet based in Finland caught between the Germans and the at-the-time pro-German Soviets), handing the Germans effective control of Eastern Europe and its resources, and even worse freeing up a few million veteran German and Austro-Hungarian soldiers to be shifted to the Western Fronts in Belgium/France, the Alps, and the Balkans. The Bulgarian and Turkish armies were suffering from heavy battering but were still fighting on and tying down hundreds of thousands of men, as was von Lettow Vorbeck in Eastern Africa. While the Turks and Bulgarians had been defeated by the time the transfer had been completed, Germany and Austria-Hungary still planned two massive strikes designed to break the back of the Western Allies and force them to capitulate as they had Russia and Romania with the Operation Michael in the West and the Austro-Hungarian Spring Offensive towards Venice against Allied forces that were greatly stretched thin. All the while the untried US military was still on the wrong side of the Atlantic. The result was that the Germans almost smashed their way into Paris and the Austro-Hungarians nearly breached the last defensible line before an evacuation would have been necessary. And within a few months, both enemies had been defeated in what must be one of history's greatest turnarounds.
 * Another example is the so called "Long Night" coined by Western intelligence in the Cold War, dating from 1956 to 1979 more or less. It started with the fiascoes of 1956 - including the humiliation of the fall of Budapest and the Ike-induced rifts between the US and the Anglo-French -, continued straight through Vietnam and the resulting bloodbath, and ended with the fall of the Shah and the loss of one of the last remaining Western outposts in the Middle East. During this point in time, the general consensus amongst historians and strategists - West, East, and neither - was that if the Soviets rolled the dice, they probably would have won. That, or triggered an Earthshattering Kaboom, all depending on whether the West was willing to retaliate.
 * This is what the first part of the Korean War looked like: the North Koreans marched south, destroying or pushing away any and all Western allied resistance, to the point where they were trapped in a tiny split of land around Pusan fighting desperately to hold on to their final foothold on the Korean mainland against vastly superior North Korean forces, living hand-to-mouth for weeks under intense pressure. Termed "looked like" because (as many have pointed out), Pusan could have been evacuated in fairly good order if it were not possible to be held, and the amphibious invasion force that would eventually launch at Inchon was already well underway in planning and organization, so it is questionable to see what effect the actual conquest of Pusan would have had.
 * The Pusan Parameter was defended by the US 7th Cavalry, which has a history of fighting to Near Villain Victories.
 * Mid-1920 in the Polish-Soviet war looked very much like this: after the Ukrainian offensive had collapsed due to arriving Soviet reserves, the Poles and their surviving Ukrainian allies were pushed deep into Poland itself, outnumbered, outgunned, and logistically cut off. The supplies it was dependent upon for survival were being waylaid by pro-Soviet forces (including but not limited to an Anglo-French dock strike, a rail strike in Czechoslovakia, and pan-Germanic inspired strikes at Danzig), the Soviet army had seized Prague - a suburb of Warsaw- and was now planning to take the main city, Budyonney in the south was moving towards Lwów, the Polish military was ill-equipped, outnumbered, and divided, and the Soviets only needed to break through the final line of Polish resistance before making it to the German mainland in preparation for what they believed would be a great, unified proletariat revolution, which the Western Allies - weary from the strain of WWI and beset by internal dissent - would have struggled to survive and overcome. Then ... well, the Miracles of the Vistula and Zamość happened.
 * Speaking of Poland, the Second Siege of Vienna looked a lot like this at one point. A massive Ottoman Army was steadily advancing towards the city, blowing up its defenses with gunpowder and slowly starving and exhausting the city's inhabitants to death by cutting off all supplies and keeping the attack going day and night. To this day you can see cannonballs in the side of St. Stephan's Cathedral. Previous Austrian cities that had surrendered had gotten massacred, and it was looking like Vienna would follow suit. Then King Jan III Sobieski of Poland came roaring in with the largest cavalry charge in history.
 * Institutional racism against Black Americans. Considering that degenerates like William Lynch actually studied methods to keep blacks enslaved and useless as functional human beings, and that his diseased ideologies managed to spread to near every corner of American life, it is a miracle of the status black Americans in the United States have today. However, today's gains make it easy to forget just how dire the plight of black Americans were. There was a time that it was simply impossible to have any kind of bank give you money for any venture. Everyone from the local law enforcement to the KKK could rape, kill, and beat blacks with impunity. And if that weren't enough, blacks were only given jobs that guaranteed they'd risk life and limb. And now ... we have a black president. Life is funny that way I guess.
 * The Mongol Empire would have likely smashed through Europe and then the renmants of Asia had Ogedei Khan not died suddenly.