The Black Tattoo is an incredibly epic example. Jack Farrel began as an Audience Surrogate who was only there because his best friend Charlie refused to join the secret society dedicated to protecting the world from a demon known as the Scourge without him, and really had no greater purpose in the main plot. Charlie's foolishness and arrogance get Jack accidentally sent to Hell, but Jack's determination and desire to help his friends eventually drive him to help Action Girl Esme stop Charlie and the Scourge, and it's his actions that ultimately wind up saving the world.
A ditzy cultist hands the newborn Antichrist off to the wrong unsuspecting parents in the beginning of Good Omens, thus setting off a plan that derails Armageddon itself. Of course, this may have all been a bigger Gambit Roulette planned out by Powers That Be.
Used and inverted in J. R. R. Tolkien's The Lord of the Rings. In order to destroy the One Ring and defeat Sauron once and for all, Gandalf develops an Indy Ploy / Batman Gambit to sneak the ring right under Sauron's eye into Mordor and Mount Doom, the one place it can actually be destroyed. It almost worked except the One Ring itself spanners the plan by finally corrupting Frodo. Then Gollum anti-spanners the One Ring's spannering by grabbing it and accidentally falling into Mount Doom. Supposedly, Gandalf knew that the Ring would ultimately corrupt Frodo, especially since it would be the most powerful within the Cracks of Doom, and that another Spanner like Gollum would have to occur for the plan to work.
Merry, Pippin, and Sam are all Spanners to some extent as no one, not even Frodo, wanted them to come along on the quest. Even so, each one of them took actions that enabled Sauron's downfall.
As revealed in Tolkien's other works, it's a little more a question of faith on Gandalf's part; he is literally an angel, a messenger from the divine, and he is certain that there is a god who watches over the people of Middle Earth. His cryptic comments about "the pity of Bilbo deciding the fate of many," and "my heart saying Gollum has a further role to play before the end," coupled with Frodo's growing sensitiveness to these things and his threat to Gollum that he could, "command him to leap off a cliff or throw himself into a fire" certainly hint that the Big Good Eru willed Gollum to be the Spanner.
In Isaac Asimov's Forward the Foundation, amidst the chaos surrounding high-level plots and counter-plots, Galactic Emperor Cleon I is assassinated by a totally insignificant palace minion, because he (Cleon) was insisting on promoting said peon, against the peon's fervent wishes, from "gardener" to "chief gardener".
Gunner First Class Ferik Jurgen, assistant to Ciaphas Cain, turns out to be the one who most often saves the day, with his combination of being a "blank" who nullifies psychic powers and the fact that he carries a really, really big gun.
Rincewind never wants to get involved in events, being a coward. In Interesting Times, his great ambition is to stay as far away from the villain's Evil Plan as possible. However, he always seems to run away from danger in the direction of even more danger... until he winds up cornered and desperate, at which point he does the right thing in spite of himself.
Some of the more inept members of the Ankh-Morpork City Watch, especially Sergeant Colon and Corporal Nobbs, fit this trope. The Watch book Thud! also has Brick the troll, who literally stumbles onto a plot to frame trolls for the death of a well-known dwarf.
In the ending of Making Money, protagonist Moist von Lupwig is on trial for the (past) mis-tradings of the bank he is in charge of. Cosmo Lavish and Cribbins are planning to use this opportunity to absolutely discredit him by revealing that before being Chairman of the Bank (and before it, Head Postmaster), Moist was a professional conman and thief and still had a death penalty extant on his nomme de felonie. The first thing Moist does in his witness speech is confess to exactly these crimes, and he remarks internally that he can see the distress in Cosmo and Cribbins' faces immediately.
The A Song of Ice and Fire book A Feast For Crows has Lysa. And Jaime. And Robb. And Allerie. And Roose. And so on and so forth. Westeros is so awash in spanners it's a wonder that it's ever experienced peace. But of course, as anyone who's finished Dance with Dragons knows, Varys is the motherfucking king of all spanners.
As early as the first book, Bran witnessing Jaime and Cersei's incest and getting pushed out a window is a huge spanner. It was a complete coincidence and no one- not even chessmasters like Littlefinger or Varys- could have predicted it, yet it directly sparked a chain of events that would eventually lead to the War of the Five Kings, the main conflict of the series.
Joffrey can also be a spanner at times: While for the most part he's fairly predictable, his cruelty and insanity occasionally lead him to do things that no one would expect, such as ordering Ned Stark's execution, despite his mother and Varys and Grand Maester Pycelle all telling him to let Stark join the Night's Watch instead. And let's not forget that even before he became king, he was the one who sent an assassin to murder the comatose Bran, just because he'd heard a passing comment by his father about how the boy would be better off dead.
Edmure Tully combines this with Nice Job Breaking It, Hero! when, on his own initiative, he leads a successful attack on Lannister forces that not only derails Robb's plans to trap said Lannister force in their territory but delays them enough to receive word of Stannis' attack on King's Landing. This allows Tywin Lannister and his forces to go be Big Damn Heroes, derailing Stannis's bid for power.
One of the lingering plot points is the state of Robb Stark's successor. Robb 's death has lead to a power vacuum in the North. Knowing that this may happen, Robb named his half-brother Jon his successor in the North, ahead of his younger and full-blooded younger sister Sansa. Considering that poor Sansa was, at the time, a political prisoner, this will screw over both the Lannister's and Littlefinger's ambitions to take control of North if this comes to light.
Arya Stark embodies this, by virtue of being the completeopposite of what's expected of a sheltered, aristocratic girl. The Lannister's ambush and capture of the Starks is derailed because they didn't expect Ned's nine year old daughter (who had been overlooked in favour of her more important sister) to have the skills to escape or a swordsmaster to help her. For the rest of the series, virtually all the nobles assume she couldn't have survived on the run and is long gone. In actual fact Arya has been present at multiple crucial events across Westeros disguised as a commoner, including contributing to the Fall of Harrenhal, allying with the world's most infamous assassins and witnessing the murder of her family at the Red Wedding. Along with her little brothers Bran and Rickon - who are also assumed dead - her survival means House Stark isn't nearly as broken as everyone thinks and it's heirs are still out there.
Kender, gully dwarves and gnomes in the Dragonlance series...especially (by their very nature) the kender. While all of the above races have the ability to change events in the past through time travel, due to their origins as races created by the Greygem of Gargath (pure Chaos-in-a-rock), kender have innate fearlessness, insatiable curiosity, guileless but mischievous personalities, and chronic kleptomania as racial traits. Tasselhoff Burrfoot, for example, is both the Unwitting Pawn of Raistlin's evil schemes and the only person unpredictable enough to screw them up. One of the most dreaded sounds on Krynn is the sound of a kender saying 'Oops.'
Given the choice between being locked in a room with a hungry dragon or a bored kender, anyone with any sense picks the dragon.
Remember, the cruelest thing one can do to a kender is lock him up. The cruelest thing one can do to anyone else is to lock them up with a kender.
The Havenites' plan in the first book relied on the laziness and incompetence of Basilisk Station's CO, Pavel Young. When Honor was assigned to the station, she was supposed to serve under Young. What actually happened was Young immediately left Basilisk for "much needed" repair work on his ship, with the hope that leaving Honor in the lurch would ultimately sink her career. In his pettiness, Young took his own incompetence out of the picture and replaced it with an officer bound and determined to do her duty despite her limited resources and possessing the competence to do so.
This trope is sort of discussed in the second novel where the protagonist explains to her subordinate that the best swordsman in the world doesn't fear the second-best one, but the worst swordsman in the world, because he can't predict what the dumb son of a bitch will do.
Apparently there is some truth in that. An inexperienced swordsman is more likely to do something that gets both combatants killed than an experienced one trying to avoid dying.
A similar thing happens in the Age Of Unreason series, where a guy is killed by someone who cannot fence at all; he automatically assumed his attack was a mere feint, because no fencer would make such a clumsy attack. Too bad his opponent is not a fencer...
A character in Echos of Honor is known as "Silver Spanner" Maxwell, after a Noodle Incident involving a dropped spanner produced spectacular (and expensive) results, six years previously.
Aivars Terekhov pulls this in The Shadow of Saganami when his ship happens to encounter the same ship, using two different identities on two different planets, running weapons to terrorists on two different planets. Using evidence found on that ship, Terekhov figures out the antagonists' plan and quickly rushes to put a stop to it.
The best part is that they only noticed the discrepancy because Aikawa, the midshipman on watch, was bored, so he ran a detailed analysis on a random freighter.
Arnold Giancola is this on a couple of levels. His actions doctoring diplomatic correspondence led to a resumption of the war when his plan to score a political coup backfired spectacularly. Despite other characters believing he was, he actually was notpart of the Ancient Conspiracy making a power grab but instead acting on his own. Later, his purely accidental death further derails investigation meant to examine his original actions.
Near the start of the series, Rob S. Pierre's son is killed in the opening skirmish of the Haven-Manticore war. The anger drives Rob S. Pierre to organize a coup to overthrow the Alpha Lines known as the Legislaturalists.
The whole reason the Alignment resorted to installing the Legislaturalists to rule the Haven in the first place was that the pre-PRH Havenites, being sticklers for the human rights and a regional superpower to boot, were constantly ruining the Alignment gambits for Galactic domination through genetic manipulation simply through the basic decency of their officers and the power of their Navy. Installing a controlled and inefficient hereditary government that crippled its own economy (that latter tried to fix this by conquering their neighbours) allowed the Alignment to both shift the Haven's interests elsewhere, and ruin their previously stellar reputation. It took at least 400 years, a largest war in the Humanity's historynote The Battle for Manticore in the last stages of the Havenite wars, described in At All Costs in all its gory details, was a single largest pitched battle ever fought by humans since the beginning of time. and two revolutions to fix.
Following the Green Pines incident, they placed the blame on Manticoran agent Anton Zilwicki, as he was confirmed to be there and they Never Found the Body. Coupled with Zilwicki and Victor Cachat's transport breaking down and requiring more time to return home than they would've needed otherwise, they had every reason to think he was dead. Not only are Zilwicki and Cachat alive, they also successfully extracted Dr. Herlander Simões, a defector. So not only do they get caught in a lie, now that Zilwicki can challenge their version of events, but Simões has just enough information to alert Manticore and Haven of the Mesan Alignment.
In Shadow of Freedom, The Alignment's operatives have been going to worlds on the Solarian League's borders, posing as Manticorans and offering aid to various La Résistance movements. The idea was to damage Manticoran PR by having these movements' failures appear as though Manticore offered aid then left them in the lurch. This plan is Spannered by one world seeking to contact Manticore independently, alerting them of the plan on the one hand, and Manticore being actually all FOR the aid on the other.
John "Anjin-san" Blackthorne in Shogun is a rather magnificent one, as circumstances force him into a key role in the Gambit Pileup of choosing Japan's next shogun in the year 1600. And he's based on a real guy, to boot.
In Malodrax, Lysander steps in the middle of conflict which would elevate either Shalhadar or Thul as the leader of eponymous planet and begin the next dark crusade. With his meddling, neither Chaos power succeeds.
Lysander himself only manages to escape and begin his "spannering" when a scalpel used in his vivisection breaks, giving him a lockpick.
Siege of Castellax is a double whammy: while techpriest Oriax sabotages the Iron Warriors throughout the novel, captain Rhodaan doesn't submit to Bolivian Army Ending planned for them and ends up being Spanner in the Works for Spanner in the Works.
Tom Clancy's Executive Orders: A pair of domestic terrorists spend most of the book preparing a massive cement truck bomb to kill Jack Ryan, driving it all the way across the country, dodging roadblocks put up as a result of The Virus spread by the otherBig Bad of the book, only to be pulled over and arrested by a random Highway Patrolman just doing his job when they panic.
The titular assassin of Frederick Forsyth's The Day of the Jackal seems well ahead of the international police effort to stop his attempt on Charles de Gaulle until some things come up to derail his plan. Just one of many comes up when his seduction of a baroness to gain a hiding location falls apart when said baroness eavesdrops on a call with his informant, forcing him to kill her and letting the police make him publicly wanted as a common murderer.
And ironically, his last spanner was de Gaulle himself, who leaned forward to kiss a recipient on the cheeks instead of shaking his hand like the Jackal expected, therefore making the Jackal's shot miss and giving Lebel enough time to stop him.
It is revealed that the Child-Goddess Aphrael and her priestess Sephrenia were this to The Man Behind the Man without ever realizing it until his plans were exposed.
Protagonist Sparhawk is essentially a personification of this trope. As the "man without destiny", no one can really divine or guess what exactly he's going to do in the future...not even the gods, who are scared shitless of him.
In James Swallow's Warhammer 40,000Deus Sanguinius, Rafen shocks Arkio's forces by being alive. Inquisitor Stele is quite glad that he will die in single combat, because he had landed in the plans by a fluke and quickly grown to "the most serious nuisance." Of course, he wasn't dead at that point...
Mat Cauthon in The Wheel of Time almost literally personifies this trope. He isn't stupid, but he's rarely clued into just what exactly is going on around him. Despite this he foils many schemes, especially when he's actively trying not to.
And similar to the line mentioned in Honor Harrington above, when the White Tower's weapons master tells Galad, Gawyn, and Mat a story about history's greatest swordsman, who was only defeated once in his entire life - by a random farmer with a stick.
In Rainbow Six, Eddie Price's pipe-smoking after success missions is the first in a series of little things that clue The Dragon in to the true nature of Rainbow despite efforts to hide it. Carlos the Jackal's fellow criminals, in carrying out an attack to try and get him freed, gets the team some good publicity that gets them to view the Sydney Olympics for free and puts them in the right place to foil a vital part of the villain's plan. One of the villains' captives manages to get off an email, the investigation into which eventually helps lead the way to them. One of the named minions tells The Dragon, hitherto ignorant of the truth, about the extent of the plan, prompting a vital Even Evil Has Standards moment that causes him to go to the good guys with the information, allowing the case to be cracked.
In the Dale Brown novel Executive Intent, Wayne Macomber would have avoided capture by GRU agents had he not stumbled over a random civilian in the wrong place at the wrong time, who proceeded to inform the police and make the already suspicious GRU agents take action.
In Bystander the villains run into a very severe example of this, when they have a great plan to capture Lucretica, and are foiled by two details. One, they have a severely incorrect estimation of her power level, and two: Her feet don't touch the ground.
In Harry Potter and the Half-Blood Prince, Draco Malfoy's act of disarming Dumbledore completely derails the gambits that both Dumbledore and Voldemort had in place in regards to the Elder Wand. Though with a bit of luck it ends up working out great for Harry himself.
Fireheart in Warrior Cats. He completely ruins Tigerclaw's plans by running into the cave where Tigerclaw was during a battle and beating Tigerclaw up.
In The Dresden Files novel Changes, they are able to narrow down the location of where the sacrifice will occur because even though the records for the first shipment were destroyed, the red court still had to transfer another shipment due to the fact that the previous shipment was incomplete due to minion carelessness. As such they needed to keep one copy of the records intact until after the final checkup and they kept the records in the van they needed to use to transport the goods. As such Harry is able to narrow it down and eventually find Chichen Itza, enabling him to blow the Red Court's plan sky high.
Harry in general serves as this for many a grand villainous plan, in much the same fashion as John McClane.
The Gatekeeper himself lampshades this in Cold Days.
The Gatekeeper: Unwittingly or not, virtually your every action in the past few years has resulted in a series of well-placed thumbs in the adversary's eye.
In Queste, the fourth book of Septimus Heap, Jenna and Beetle are this to Tertius Fume's plan to kill Septimus with the Queste.
In The Dance of Time, the final book of Eric Flint's Belisarius Series, there is a side plot of a Malwa assassination team tasked to kill Byzantine Emperor Photius and Empress Tahmina but keeps getting foiled by unexpected changes of plans of their targets. The team follows them for thousands of miles while the plot of the rest of the novel occurs around them. At the end they run across the fleeing Malwa emperor and the Big Bad (currently inhabiting the body of an eight-year old girl). They kill him and his guards and wound her which makes it possible for the good guys to finally achieve complete victory. They get rewarded by being sent into exile with the series' Manipulative Bastard.
In The Demon Headmaster books, Dinah manages to be both this and an Unwitting Pawn at various points. The Headmaster can easily hypnotize her, and she's very close to being his greatest asset, but she's just intelligent enough to shake it off and bugger it all up at the last minute. For the record:
Book One is the one where they meet. He doesn't know her capabilities.
Book Two has him not knowing her new name.
Book Three has him not even realising she could figure it out.
Book Four has him specifically targeting her for her DNA.
Book Five has his clone, who doesn't even know she exists. Dinah stumbles on this one purely by accident.
The final book has him attempting to demoralize her. He almost wins, and would have had Dinah not had a last-second burst in hearing capability.
In one of Francoise Rivier and Michel Laponte's Jonathan Cap books, recurrent character and local Plucky Girl Juliette becomes this. She has her appendix removed in a Parisian private clinic and notices that both her doctor and the nurse in charge of her are acting strange, notifying Jonathan's Kid Sidekicks Alex and Nico about it so they can call Jonathan and investigate. It turns out the doctor is the Big Bad of the book, with a complex plan involving an Arabian prince and his Body Double (the Big Bad's "disciple"), and the nurse is his forced accomplice because he threatened to kill her if she didn't collaborate. The plan would've gone smoothly, had the Big Bad not been pretty much forced by the circumstances to be the doctor in charge of Juliette's emergency surgery...
In the historical novel Wings of Dawn: Thomas, to the Druids. Umar and Hadad, to Sir William. The Mamelukes and the bandit troops, to everybody.
Mark Twain's short story "Luck" speaks of Lieutenant General Lord Arthur Scoresby, V.C., K.C.B., etc., a complete idiot who got on the fast track to war hero-ism because he got his left and right mixed up in battle and accidentally led his regiment right into where the other side was preparing a surprise attack, and drove the ambushers into full retreat because there was no possible way they would be discovered in time, and so didn't prepare.
Miss Emily Dorothea Seeton, created by Heron Carvic. She's difficult to describe. As far as she's concerned, she's a retired teacher the police use as a sketch artist, not an amateur investigator. So when the bad guys come after her, she usually has no idea why they're doing so. Her reactions usually end up with the villains in custody, the case closed, and quite possibly police trying to write reports that make sense.
In Academ's Fury, Sarl and the Vord would have won if it wasn't for one person: Canim ambassador Varg. He managed to figure out their plan, and because he doesn't like the duplicity involved, goes out of his way to stop it. They did plan for him, but they figure that because he is hated, nothing he says will be believed. And they would have been right, had Varg not ended up skipping diplomacy and outright dragging Tavi to the Vord nest, alerting Tavi to the threat and allowing him to prepare.
Tavi's aunt Isana was also an unknown factor. She knew about the Vord from Calderon, and it was because she cut a deal with the Aquataines (whom she had hated before) to get support for the legionnaires fighting the Vord in Calderon, and got Invidia Aquataine to counterattack the Vord, breaking their attack.
In the next book, Cursor's Fury, Tavi, who was in need of bribe money, steals a purse from an officer who had it out for him and in doing so saves Alera from the Canim. How did he manage that? The purse was part of a plan to let a traitor assume control of the one legion that stood in the Canim's way. The idea was that Canim ritualists would strike the officers' tent with lightning during a meeting when they were all sure to be inside. The traitor would have a stone that would No-Sell the magic, and allow her to take control of the legion and force them to walk away from the important strategic point they were guarding. The purse that Tavi stole belonged to the traitor and had the stone inside. She was not able to find the stone, and so was forced to flee. The magic lightning struck on schedule, but because the traitor was not there, control was instead handed over to Tavi, who managed to lead the legion to victory. For added Spanner-ness, that very stone was a big part of Tavi's plan to ultimately defeat the Canim.
In No Good Deed... Elsabeth and Hieronymus accidentally foil Cuncz's plans to steal incriminating information about himself from Father Garnerius when Garnerius hires them to recover the reliquary (where the Abbot stashed the documents) stolen by Cuncz's agents. Cuncz just shrugs off the setback and hires them to finish the mission instead.
In the Past Doctor Adventures novel "Corpse Marker", a complicated Batman Gambit is in progress when the Doctor and Leela arrive. Over the course of the book, the plan slowly falls apart thanks to their presence (and another complicating factor the planner didn't know about).
Malice Aforethought ends with Dr. Bickleigh's plan to get away with the perfect crime being derailed by drain pipes (It Makes Sense in Context).
Being Divergent makes Tris immune to the mind-control serum, which allows her to ultimately stop the attack on Abnegation.
In the first Song of the Lioness, Duke Roger's plot to use a healer-draining Mystical Plague to kill his cousin Jon and reclaim the position of direct heir goes off without a hitch. He had no way of knowing that one of Jon's fellow pages would have healing magic, particularly as Alanna was afraid of her magic and actively hid it until Jon's illness forced her to use it. Later, Roger accidentally triggers The Prophecy when he sends both of them off to a cursed city—they end up cleansing it of the demons. After that, Roger goes to great lengths to kill her first so this won't happen again. His final plot to kill the Queen and magically hide himself from any suspicion is derailed by the fact that his waxwork was of the boy Alan, not the girl Alanna really was. If she hadn't hidden her identity to become a knight, it would definitely have been King Roger.
On top of that, Alanna wouldn't have confronted Roger if the Chamber of Ordeal didn't decide to literally show Alanna her worse fear of Roger killing Jon by allowing her to claw through the bag keeping things obscured from her and the rest. For even more humiliation his berserk fury when he accidentally cut Alanna enough to reveal that he is actually a she resulted in Alanna getting the clear upper hand in the duel by being more clear-headed.
In the final book, Roger didn't count on Alanna learning to "let go", literally, making the sword he was using magic to call her over to him so he could get her blood instead fly from her hand and stab him, killing him again.
In the Land of Oz, the first spanner was Oscar Diggs. He quite literally lands in the middle of a Succession Crisis (King and Queen dead, only heir is an infant girl, four Witches set to go to open war with each other for control). Magnificent Bastard he is, he uses a combination of bullshit, carnival tricks, technology, and mistaken identity to create an Enforced Cold War and set himself up as a God-Emperor. The peace is fragile, but holding. Years later, a tornado brings the second spanner in the form of Dorothy, who accidentally squishes the East Witch with her house and wrecks the whole balance of power, setting off the chain of events that leaves both West and East Witches dead, Diggs exposed as a fraud and fleeing in terror, and paves the way for now-grown Ozma to escape the slavery Diggs sold her into and reclaim her throne.
In Leviathan Eddie Malone pretty much has this as his job. He's a very affable man, but he's also a reporter chasing after a story. He likes and helps out the protagonists, but he can't go too long without sending something back to his editors, and he has a knack for research and finding out very important secrets, as well as a genetically engineered frog who can memorize and repeat things said in its presence. For example, in Behemoth, he's responsible for getting an interview with Alek into the papers, and almost would have revealed the Committee for Union and Progress's plan too early, but he's also the only reason it succeeded, as he warned Alek about the giant Tesla Cannon, which would have destroyed the Leviathan and left the C.U.P. vulnerable to the ships Goeben and Breslau.
In Angel in the Whirlwind: The Oncoming Storm, Kat Falcone intercepts a ship carrying a princess of the Theocracy who is trying to defect to the Commonwealth. She alerts Kat to a fleet buildup on the border planning to invade, and Kat goes to check it out and ends up blowing the lid off Admiral Junayd's entire plan, forcing him to launch the invasion right then, before his supply lines have caught up, or risk having the Commonwealth 6th Fleet actually be ready for him.
The Stormlight Archive: Kaladin becomes one of several for the plot laid out by the Diagram, a supposedly-omniscient plan to save the world by putting King Taravangian in charge by killing all the competing world leaders. It's implied that all Surgebinders are Spanners, but Kaladin is the one we see the Diagram fighting most directly.