Accidental Truth

""Gwendolyn, it is a terrible thing for a man to find out suddenly that all his life he has been speaking nothing but the truth. Can you forgive me?""

- Jack, The Importance of Being Earnest

""It was a lie at the time.""

- Susan, El Goonish Shive

It looks like a character is going to get caught out in a lie that they told, but then they're unexpectedly saved - they didn't know it, but what they said was correct all along, or has become correct quickly enough that they're safe. Maybe it's just a lucky coincidence, or maybe one of their friends quickly and quietly arranged things to save them, but either way, they've avoided having their lie exposed.

Often, a character rescued in this way will just be relieved about it. Sometimes, though, the character will feel guilty about their lie, especially if there's some Oblivious Guilt Slinging - if so, they may show their strong moral character by rejecting their chance at escape and owning up to the lie.

Compare Right for the Wrong Reasons, where a character follows an erroneous chain of logic to a correct conclusion, and Accidentally Accurate, where a creator does not do the research, but gets it right anyway.

Anime and Manga

 * In Fairy Tail
 * In episode 26 of Nichijou, the girls decide to celebrate Nano's birthday on little more than a whim of Yuuko. They even go so far as to buy her a cake. Nano's simply left wondering how her friends knew it was her birthday.
 * In Beelzebub, in order to make their fellow students interested in finding En, Furuichi told the rest of the delinquents that he is from Akumano Academy (instead of being from, you know, hell and that En in a demon). Then after he managed to make En mad, En took over Ishiyama High and make it into an actual Akumano Academy, filled with 394 demons.

Comics

 * In one Silver Age Superman story, Jimmy Olsen is kidnapped and interrogated about Superman's identity. He buys himself some time by claiming that Superman is "my boss at the Daily Planet". Guess who's filling in for Perry White when the crooks show up with a chunk of kryptonite...?
 * In Thunderbolts Baron Zemo goes by the codename Citizen V and proclaims to the media that he is the grandson of the original Citizen V who fought Nazi's in World War II. Helmut's father killed the original Citizen V during World War 2 so Helmut was sure the original Citizen V had no children or grandchildren. A few years later Zemo gets beheaded and thanks to a prank from his former team member Techno he wakes up in the body of the grandson of the original Citizen V.

Film - Animated

 * Ice Age 2: The fast talking salesmammal predicts a devastating flood to help his sales, which is confirmed to be actually happening.

Film - Live-Action
"Judge Stevens: (irritated) Can't it wait? Fletcher: (crestfallen) Yes, it can. ...but I've heard [emphasis added] that if you hold it you can damage the prostate gland, making it verrrry difficult to get an erection or even become aroused! Judge Stevens: Is that true? Fletcher: ...It has to be! Stevens: ...In that case, I'd better take a short break myself."
 * In Liar Liar, Jim Carrey is occasionally surprised at what he's "allowed" to say while cursed to tell the truth. For instance, he asks for a toilet break...

""I'm a bad father!""
 * That particular scene was even shielded by savvy screenwriters from Science Marches On, should it ever be proven that doing so does not cause the cited damage, by having him saying, "...but I've heard that..." leading into the claim.
 * More to the point of the film, he's also surprised when he is able to say that he really wanted to see his son that day. "How 'bout that, I do."
 * In it's most heart-breaking form:

Literature

 * In the Hornblower books, the protagonist has to convince a party of Napoleon loyalists to abandon their mission to restore their deposed Emperor, and he sees no option but to give his word of honour that Napoleon has died. When he gets back to port, he is met by the news that Napoleon actually had died, getting him off the hook. Characteristically, though, he still beats himself up over what HE knows was a lie.
 * At the beginning of Les Misérables, Valjean is caught after stealing the bishop's silver, and makes up the story that the bishop gave it to him as a present. The skeptical policemen take him to the bishop, and the bishop surprises both them and Valjean by confirming the story and adding more valuable gifts on top. Cue Heel Face Turn.
 * Towards the end of Neverwhere Richard pretends to have a key the antagonists want. He lies so badly that they assume (correctly) that he's trying to protect Door and ignore him. Unbeknownst to him, she'd slipped the key into his back pocket.
 * There's a pretty brutal version of it in The Wall by Jean Paul Sartre. A political prisoner is given the choice between execution or turning traitor and giving the location of a collaborator. At the last moment, he delays the execution by making up a location so that the army will look foolish, knowing full well that the collaborator is hiding far away from there. The army searches...and it turns out the collaborator had to switch hiding spots to that location. He is killed, and the man goes free.
 * Alan Dean Foster's Star Wars Expanded Universe novel Splinter of the Minds Eye. Luke Skywalker is given a small container but is not told its opening combination. When he's captured, he pretends the container is his. His captors test him by asking him the combination: he is forced to bluff and say "It's open". They try it, and it works: it was open.
 * In the Enemy Lines duology, Smug Snake Viqi Shesh is in the hands of the Yuuzhan Vong, and on the verge of execution. In order to prove her worth to them (and spare her life long enough to escape), she pretends to have found a conspiracy against the Warmaster: the "shapers" (their equivalent of scientists and doctors) are deliberately causing one of his artificial limbs to be rejected. As it turns out, the conspiracy not only exists, but is found and rooted out relatively quickly—more quickly, it also turns out, than Shesh would have liked.
 * In H. Beam Piper's novel Space Viking, Lucas Trask distracts his divided followers by inventing a conspiracy by his enemy Andray Dunnan to subvert and take over the planet Marduk. It turns out that that's exactly what Dunnan is up to.
 * Another example is in Piper's novel The Cosmic Computer, in which the protagonist travels to Earth to investigate local stories about an abandoned supercomputer left behind after a recent war. He concludes that the computer never existed, but backs off from attempts to convince people of that; instead, he organizes a search in order to stimulate the economy and improve morale. And then the supercomputer turns up....
 * Graveyard of Dreams, essentially the short version, only got up to the "organizes a search" part.
 * Gone wrong in Robert E. Howard's "Gates of Empire." Giles Hobson makes up a story about the Crusader army's intentions to impress a pretty girl with how in-the-know he is. It turns out she's a spy for the Saracens. No harm done, since he lied to her, right? Except that, although he didn't know it, what he told her is exactly what the Crusader leader planned to do.
 * Francie Nolan claims her name is Mary Frances in order to win a doll at a charity Christmas party. She feels guilty about lying, but reasons that she can take the name Mary when she makes her Confirmation. When she announces this intention, her mother tells her she can't because her real name is Mary Frances Nolan.
 * Made interesting because one of the messages of the book is that people sometimes tell what's true but write what they wish was true. If (as a lot of people do) you start thinking of Francie as the author's avatar...
 * In The Truth Teller's Tale, Truth Tellers are Exactly What It Says on the Tin: they Can Not Tell a Lie. Roelynn's father isn't nobility but he is extremely ambitious, and hopes to marry Roelynn to the prince. Roelynn is extremely flirtatious, and falls in love with a variety of men, which is explained as being a free spirit until her father ties her down. So, when the titular Truth Teller, Eleda, says that her friend Roelynn will marry the prince, it breaks both Roelynn and Eleda's hearts: Roelynn because what Eleda has said must be true, and Eleda because she has forced a lie past her lips (It Makes Sense in Context).
 * Subverted in The Devil in Vienna, where Inge recalls entertaining her cousin with a story about how she, the cousin, was really a princess but had been adopted as a baby. It turned out that the cousin really was adopted, and the adults all thought Inge deliberately tried to upset her.
 * In Dracula, when Mina Harker asks Dr. Seward to let her listen to his phonograph diary, he's worried that she won't be able to stand hearing what happened to her best friend Lucy and tries to deter her by saying he doesn't know how to go to any specific part of the recordings. No sooner are the words out of his mouth than he realizes, "Oh Crap! I really don't have any idea how to find any specific part of the diary! How are we supposed to use it to find clues about the vampire we're hunting?!" He now has no choice but to grant Mina's request to listen to the whole thing and transcribe it on her typewriter.
 * In Hills End by Ivan Southall, one the children claims that there is Aboriginal art on the walls of the cave in an attempt to sound important to his teacher. Later, when they are lost in the caves, they stumble into a chamber containing Aboriginal cave art and the bones of megafauna.
 * Terry Pratchett uses this trope a lot.
 * From Wyrd Sisters, "A man would have to be a natural born fool to want to be king."
 * Donald Westlake's unlucky criminal John Dortmunder once, under pressure, claimed his name was "John Diddums," and then started to use it as a regular alias. Whenever people asked about the name that sounds like babytalk, he'd tell them, "It's Welsh," and they'd be embarrassed for questioning it, which made them a bit less likely to question anything else he said. And then he ran into a British gentleman who remarked, "I know a Diddums family near Caernarvon. Might you be a relative?"

Live Action TV

 * Used absolutely ridiculously on All My Children a few years ago: Krystal wants David to keep the secret that Babe's daughter is actually Bianca's baby, so to stall for time, Krystal announces that David is Babe's father, even though to their mutual knowledge, they only met recently. David orders a DNA test to confirm, and it turns out he is Babe's father, due to a nameless frat party liaison 20 years back.
 * An episode of I Love Lucy has Lucy and Ethel running a raffle to raise money for "Ladies' Overseas Aid," a charity they make up on the spot on the basis of, "We're ladies, we want to go overseas, and boy do we need aid." Eventually they figure out that doing such a thing is illegal, but just as they collect all the money, a representative from the real Ladies' Overseas Aid organization shows up to collect their generous donation.
 * Buffy the Vampire Slayer has a variant, when Willow's Power Incontinence makes it so that whatever she says becomes literally true. Hilarity Ensues before anybody can figure out what's going on.
 * An interesting variant, where the character never learns he was telling the truth, in the Smallville episode "Harvest". The Town with a Dark Secret attributes their health and vitality to Human Sacrifice, but the sheriff tells Clark it's down to the Blue K in the water. It is.
 * Played with in an episode of Burn Notice - Michael goes to a lot of trouble Framing the Guilty Party as being an undercover cop, only he hid the fake evidence a little too well, and the guy's boss almost doesn't find it. At the last moment, he finds... different evidence. Turns out the guy was an undercover cop; cue Oh Crap moment.

Radio

 * In one episode of Absolute Power (the original radio version), Archie hires Prentiss McCabe to embarrass the Prime Minister, who's been getting a bit too full of himself lately. Martin makes up a story about the PM making plans to abolish the monarchy and set himself up as President. Turns out such plans were discussed, albeit not as a serious proposal... and Archie wrote up the document, making him the obvious scapegoat when the government goes into damage limitation mode.

Religion

 * The story of the "miracle of the roses", in which St. Elisabeth of Hungary is claimed to have been saved by God's own intervention. Carrying bread to the poor in defiance of her husband's wishes, she is saved from discovery when her pouch turns out (to her surprise) to hold roses instead of the bread. (Other versions say that she did not actually speak when asked what she had, however - presumably because a saint shouldn't be lying in the first place).

Theater
""For the first time in my life... rain!""
 * The Importance of Being Earnest. Jack and Algernon pretend to be brothers, then it turns out they actually are brothers. Also, Jack tells Gwendolen his name is Ernest, and it really is. (He was abandoned as a baby.)
 * The Music Man. Professor Harold Hill cons the citizens of River City into paying for uniforms and instruments with the promise that he'll train their children into a band. He does so using a "think" system which couldn't possibly work, but in the end the children learn to play anyway (albeit extremely out of tune) and he's saved from being punished.
 * Similarly, The Rainmaker and the musical version 110 in the Shade end with Starbuck's promise of rain in twenty-four hours coming true after he admitted it was all a con.

Video Games

 * Used in Tales of the Abyss. The party needs to head to Chesedonia to find out . Jade tells that the rest of the party heard a travelling Scorer was reading false prophecies in Chesedonia. Guess what they find when they get there. Jade even lampshades it, saying "It seems our lie has become the truth."
 * In Primal Jen says of Queen Devena, "I guess she's not the gal she used to be.".
 * In Ratchet and Clank: Going Commando Angela Cross says "I swear that crazy old man is not the same person I used to work for."
 * In Kingdom Hearts II, Come 3D, it turns out that he was unknowingly honest.
 * In Golden Sun: Dark Dawn, Matthew gains entry to Kaocho Palace by telling the guards he and his friends are the Adepts the king was waiting for.
 * In Uncharted,  sends the enemy mooks on a wild goose chase, and, purely by coincidence, he happens to have sent them to exactly the right place.

Webcomics
"Ellen: You lied to your mom for a guy? Susan: Yeah, I told her that Justin was gay. (beat) Ellen: Uhhh... Susan: Trust me, it was a lie at the time."
 * Happens in El Goonish Shive when Susan tells her mother that Justin is gay so that she won't mind him staying the night. Turns out he is.

"Ennesby: When I said were living in the barrel of a gun, I was being facetious. Ebbirnoth: The worst kind of prophecy is the kind that is funny."
 * It appears that Susan told two accidental truths in one night, as what she herself called a ridiculous claim has turned out to have been declared a medical condition. Officially speaking hair does spontaneously change color (here "officially speaking" is used to mean that it is claimed by the government to maintain the Masquerade).
 * In The Fancy Adventures of Jack Cannon, Angel calls the titular Jack "the toughest guy in the universe" early on, before any action had occurred. She wasn't very far from the mark.
 * A meta-example from the world of webcomics: Kris Straub made "Addictions and the Human Toll" as a parody of Least I Could Do, heavily implying that Rayne has a sex addiction and needs help. A week later, "Not Viagra" reveals that Rayne has been diagnosed with depression.
 * Happens a few times in Schlock Mercenary.

Web Original

 * Leo Bone (aka Napoleon) does this in Look to the West to try and seize a Royalist French fleet by telling the Royalists their exiled leader has formed an alliance with Britain; when they return to Corsica, turns out he has.

Western Animation

 * In an episode The Fairly Odd Parents, Timmy, sick and tired of others correcting his misstatements, wishes that whenever he gets something wrong, it turns out that he is actually correct. This results in such things as states merging so that Timmy's guesses as to how many there are will be correct. Unfortunately (or maybe fortunately), after one too many misstatements, Dimsdale is becoming a Crapsack World, and so he unwishes the wish.
 * In The Simpsons episode, Bart The Genius, Skinner didn't believe a letter that was written to explain what Bart was absent from school was from Homer until he looks at the check that he's handled to pay for Bart's vandalism. Skinner had to change his mind about charging Bart with forgery as a result.
 * In the Ed, Edd 'n' Eddy episode, Dueling Eds, Ed randomly suggest cupcakes. Remembering how Eddy just insulted Rolf, Edd further suggest the cupcakes should be offered to Rolf, which Eddy rejects. Later, when Eddy is confronted by Rolf in a duel, it was discovered that where Rolf is from cupcakes were considered a form of an apology, making Ed's suggestion being genuine.

Real Life

 * Aldous Huxley's novel Brave New World was written before the discovery of Fetal Alcohol Syndrome, yet not only did Huxley have the lower classes in the series exposed to alcohol as fetuses to make them stupid, but he also correctly identified the other symptoms as well.