Despite the Plan

""Hermione, when have any of our plans ever actually worked? We plan, we get there, all hell breaks loose!""

- Harry Potter sums up about half the series.

The dashing heroes have set up a plan to catch a villain, gain a MacGuffin or otherwise simply accomplish something.

The plan quickly deteriorates as someone has screwed up, an outside force has reacted unpredictably, or maybe fate just hates you. Despite that, thanks to either grace, improvisation or just plain fast thinking, the end goal is accomplished. Sometimes characters will count on this happening. Doesn't count if they cook up a new plan or at any time go back to the drawing board (though if that new plan isn't known to the audience...)

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

Compare with: Plethora of Mistakes.

Film

 * Just about everything in Armageddon goes wrong, but they somehow manage to destroy the asteroid anyway. Put briefly, the Russian Space Station explodes for no reason just after they refuel, one shuttle is destroyed by debris and crashes (but Ben Affleck survives), the other crashes on an almost undrillable section of the asteroid, Steve Buscemi goes crazy with Space Dementia and starts shooting at everybody, the President almost decides to detonate the nuke prematurely and then doesn't, the asteroid kills more people with geysers, but the transmitter on the nuke was deactivated, forcing Bruce Willis to make a Heroic Sacrifice.
 * Inglourious Basterds:

Literature

 * Pretty much the MO of Lawence Block's accidental secret agent Evan Tanner. Faced with a ridiculous surfeit of problems (uncover a Soviet plot at the Toronto World's Fair, avoid the Canadian authorities, rescue his adopted daughter, foil an assassination attempt on the Queen of England, dispose of a quantity of heroin) he works them out on the fly with little more than connections, friends and quick thinking.
 * The breaking into Godwin Arms and Armaments in the Science Fiction novel Profiteer by S Andrew Swann. The heroes have been betrayed, so the enemy knows they are coming, but they somehow pull it off anyway.
 * Happens frequently in the Harry Potter series, particularly in the last book, where the trio spend roughly a month planning the break-in of the Ministry of Magic, and then another month planning the break-in of Gringotts. Neither goes according to plan, Lampshaded in the film version.

Live-Action TV
"Zoe: Captain'll come up with a plan. Kaylee: That's good, right? Zoe: It's possible you're not remembering some of his previous plans."
 * The Star Trek: Deep Space Nine episode "Badda-Bing, Badda-Bang" involved an Ocean's Eleven-style casino heist where nothing went as planned, but everyone bounced back in time to pull it off.
 * They actually show us what the perfectly-performed plan looks like, too, and even mislead us a little into thinking it's the actual performance of the plan, with the characters narrating/explaining their parts. This makes the blunder-filled version that much more hilarious. And exciting. (Of course, this is the common inversion of the Unspoken Plan Guarantee: since we hear the plan, you know it won't go that smoothly in practice.)
 * The shows Farscape and Firefly are united in that every single plan goes like this, and the characters are quite aware of it.

"John: I got a plan. Aeryn: Don't tell me you have a plan! John: (insulted) Why not? Aeryn: They never work!"
 * Or:

"Hannibal's plans never work right. They just work."
 * The A-Team! Nothing Hannibal ever planned ever went the way he planned it, but the good guys won every time. I love it when a plan comes together!

Theatre

 * Cyrano De Bergerac: Some of the plans in this farce work out... and given also is a tragedy, some of them Go Horribly Right.
 * Roxane plans to marry Christian when she sees that De Guiche plans to visit her that night.
 * De Guiche plans a Last Stand for the Gascon Cadets
 * Cyrano resorts to Playing Cyrano to Christian so he can win Roxane’s love

Video Games

 * Many missions in the Grand Theft Auto series don't go as planned. Bank robberies and drug deals are particularly prone to failure. The more straightforward the mission seems, the more likely someone will botch it up or betray you and leave you running for your life.

Web Comics

 * Star Wars screencap web comic Darths and Droids: in their version of Episode One, the entire Tatooine plot arc was just a giant Gambit Roulette performed by Qui-Gon Jinn purely by accident. He made so many stupid mistakes that they came full circle and canceled each other out. Summarized wonderfully here.

Western Animation
"Pepper: Well, that went perfectly. Apart from everything."
 * Scooby Doo embodies this trope so often, it would be easier to note when it doesn't.
 * Scooby Doo Mystery Inc: chapter 2, chapter 3 & chapter 6.
 * "Scooby-Doo, Where Are You" episode, "Nowhere to Hyde" featuring the Ghost of Mr. Hyde.
 * "The Scooby-Doo Show" episode featuring Mambo Wamboo.
 * Done on the PBS children's show Clifford the Big Red Dog, when Clifford tries to catch Vaz's attention away from the latter's TV binge by hopping around outside. Instead, Clifford wrecks the satellite dish by accident, causing Vaz to go investigate. However, he sees Clifford outside, so Clifford successfully gains his attention despite the failure of his original plan.
 * Done frequently in The Dreamstone. A lot of times, Rufus and Amberley's attempts to stop the Urpneys fell short or led to their capture. They always ended up with the Dreamstone back however, given the Urpneys were perfectly able at screwing up their plans on their own
 * The Iron Man: Armored Adventures episode "Field Trip", where Tony, Pepper and Rhodey's plan to get the armour back without Stane noticing only comes off at all thanks to interference from Gene, Happy and Stane's daughter.

Real Life

 * The assassination of Franz Ferdinand. To wit, all the assassins were supposed to throw grenades, fire pistols, then drink cyanide and drown themselves in the river. Instead, all but one of them froze up, and the one who acted missed with both bullets and grenades and wasn't even successful in killing himself. (The cyanide had lost its potency and the river was too low to drown in — he was arrested immediately). Later that day, one of the guys who didn't shoot was walking out of a sandwich shop — probably feeling guilty about his massive failure — when the Archduke's driver got lost and wound up right in front of him. This time, he didn't freeze.