Unintentional Backup Plan

Where although the original plan didn't work out, something else that may or may not be completely unrelated accomplishes the same goal. When played for laughs, expect the person who made the original plan to still say, "Just as planned." May also involve MacGyvering if the unplanned event simply gives the hero what is necessary to recover from the failed plan. Might also turn a Funny Background Event into a Chekhov's Gun.

Often used to invoke an I Meant to Do That. Might also involve the plan going horribly wrong and then what caused it to go wrong yielding the intended result.

Contrast Nice Job Breaking It, Hero and Nice Job Fixing It, Villain, for when they unintentionally rescue their enemies' plans.

Compare and contrast Xanatos Speed Chess and Gambit Roulette, which involve planning for things that could ruin your plans or adjusting your plans when they might fail.

Inverse of Spanner in the Works, where someone or something causes what would have been a perfect plan to not accomplish its goal.

Compare with Despite the Plan, where it's the characters' own actions instead of an outside factor that puts things back on track.

Anime and Manga

 * Dragonball Z: Doctor Gero created several androids to kill Goku. Unfortunately for him, either they were too weak to kill him or they performed a Heel Face Turn. However, the apparation of Cell, Gero's supreme creation, who wasn't involved in the plan to kill Goku at all, managed to complete Gero's objective by self-exploding, killing Goku in the process.
 * In the last episode of Panty and Stocking With Garterbelt, after Panty and Stocking beat the Big Bad, Garterbelt comments that things went "approximately as planned", reflecting on the fact that and that the Big Bad managed to go One-Winged Angel. This follows up on two "just as planned" comments and one "not as planned" comment earlier in the episode.
 * In Death Note, Light OutGambits Near by . However, because of Mello's own unrelated failed Indy Ploy to kidnap Takada,.
 * When Natsu fights Cobra in Fairy Tail, he can't get a single hit in, because Cobra can hear what he's thinking with his incredibly sensitive ears. after badly beating him up, Cobra ends up giving Natsu an epic body slam. On the descent,

Film

 * Played straight over the course of the Star Wars saga. Qui-Gon's original plan was for Anakin to bring balance to The Force. However, he ends up falling to the Dark Side and it seems that he won't. In Return of the Jedi, however, he does bring balance to the Force by ensuring that the last of the evil aspect of the Dark Side of the Force dies with him.
 * In Predator, Dutch's plan to lure the titular menace into a deadly knife-trap fails when the Predator spots what he's up to and simply goes around it. Just as its about to kill him, Dutch notices its standing right under the trap's triggering mechanism...a giant log.

Literature
""We plan, we get there, all hell breaks loose.""
 * Harry Potter:
 * It happens all the time in the series. Harry even lampshades this.


 * Voldemort is a rare example for the villain, though it's slightly subverted. He's unaware that  As a result, he gave himself a way to win even after the other sources of his power were destroyed. Subverted because Harry still kicks his ass.
 * Dumbledore's various plans for Harry,, and were all met with some kind of adversity, but managed to work out in the end. Dumbledore apparently had even more elaborate plans prior to , since he stated that this made things "much more straightforward".
 * In The Lord of the Rings, Gandalf and Aragorn's Batman Gambit pays off in getting the One Ring to Mount Doom, but the One Ring itself spans their plans by finally corrupting Frodo at the last crucial moment. Fortunately, Gollum shows up to take the ring for himself before accidentally falling into the volcano and destroying it.

Live Action TV

 * Freqently on The A-Team, prompting Hannibal to spout his Catch Phrase, "I love it when a plan comes together."

Western Animation

 * Scooby Doo loves this trope. Oftentimes the original trap that is set will not work. Usually Shaggy and Scooby's incompetence causes it to fail in a way that yields similar results.

Other

 * Some marketing campaigns have this. The commercials may not be getting the right message across, but they sell the product just the same.
 * The Old Spice commercials fit this trope pretty well. It was supposed to advertise a body wash, but no-one seemed to buy that particular product. However, the Old Spice brand as a whole has become far more popular.