The episode begins with Stan painfully waking up. He puts on his slippers only to find, to his disgust, that they are soggy with milk. He finds a note written by Mabel saying that she had nothing else to carry her milk with. He then goes to the kitchen and switches on the light, but the bulb suddenly explodes. When he opens a box trying to replace the light bulb, he finds a note from Dipper, saying that he used all the lights to make a planetarium suit for Soos.
Stan immediately goes to a grocery store to buy a new light bulb pack. Robbie, Lee, Nate and Tambry show up behind him in the checkout aisle, but decide to move to another aisle after making fun of Stan. Stan retaliates by declaring he was going to shoplift most of the light bulbs. A nearby cashier overhears Stan and calls out the security. Stan attempts to use a smoke bomb to escape, but fails since the smoke bomb had been long expired. Stan ultimately goes home safely, with some bruises and the light bulb pack. Unfortunately, his efforts were for naught, as Ford has already replaced the bulb with one of his own invention that will last for one thousand years and make their skin softer. Infuriated, Stan sits down to watch the TV, tuning in to the local news. Stan is shocked when the news reports that Mayor Befufftlefumpter has died, and there will be a meeting to decide potential candidates for the new mayor of Gravity Falls in the afternoon.
Later that day, all the people of Gravity Falls have gathered inside town hall. Sheriff Blubs reveals the requirements to run for mayor: you must be able to cast a shadow, count to ten, and throw your hat into a provided hoop. Bud Gleeful throws his hat into the ring, to the shock of the townspeople. He begins to speak, believing his victory is assured, until Stan throws his own hat in after hearing Dipper and Mabel discussing how great it would be if Ford became elected for mayor, challenging Bud for mayorship. Stan asks the townspeople if they're just going to let Bud Gleeful win, and they say they won't. Several of the townspeople throw their hats in the ring as a result. Bud tells Stan that he just made a powerful enemy and that he was going to let bygones be bygones, but his hand has been forced. Dipper and Mabel are worried about Stan running for mayor, and they don't think he'll be a particularly good candidate. Regardless, the Mystery Shack tries to build up hype for Stan's campaign. He goes on a disastrous radio interview which Dipper and Mabel stop by force. Eventually, Dipper is fed up with Stan and goes to ask Ford for help in the basement. Ford gives Dipper a device he believes could help - a pair of mind-controlling ties. If Dipper wears the controlling tie and Stan wears the other tie, Dipper will be able to influence Stan's actions. Dipper tells Mabel about the mind-controlling tie, and the two agree that it's for the best that they use it on Stan. They test it on Soos first, and find that it works with flying colors. Dipper and Mabel proceed to use the tie on Stan in order to steer his campaign the right way, making him immensely popular in the town. Stan makes a speech about America, Freedom, and "Amerifreedom". Stan is unaware of everything he says while controlled, however, Dipper and Mabel are only able to have Stan keep wearing the tie by telling him it's his "lucky tie."
Meanwhile, Bud is unable to figure out what he's doing wrong and how Stan is doing so well in his campaign. He excuses himself from the rest of his supporters and goes to speak with his "campaign manager" in another room - Lil' Gideon. Bud has kept in contact with him within prison, and is running for mayor for the purpose of busting him out of jail. After Gideon hears how bad Bud is doing in the elections, Gideon decides to use a last resort - a one-use possession spell detailed in Journal 2 that he kept hidden in his hairdo. Gideon uses it to possess Bud without anyone knowing.
On the day of the final debate, Stan decides not to wear his lucky tie. Mabel and Dipper try to convince him otherwise, but when Stan gets into an argument with the kids, Dipper angrily reveals the power of the ties. Angered, Stan leaves for the debate. Dipper and Mabel realize that they need an independent candidate. Soos stumbles out of the bathroom with his head stuck in his shirt sleeve, and the twins realize they have their man. Bud, Stan, and Tyler Cutebiker arrive at the debate. Bud is speaking like Gideon, which weirds Stan out. They take their positions as Soos appears, wearing the tie. Stan is surprised when he sees Soos. Stan spots Dipper and Mabel behind the curtain wearing the controlling tie and angrily attempts to debate with the crowd. His approval ratings plummet, and Stan becomes angrier and angrier.
Bud uses Gideon's charisma to convince the crowd to vote for him. An intermission is called. Dipper and Mabel wonder why Bud is acting so much like Gideon. Bud (being controlled by Gideon) walks out and grabs them. The television Bud is wearing shows Gideon, who taunts the Pines kids, calling them "eviler". He forces Bud to tie the kids up in the nose of the statue built for Mayor Befufftlefumpter, which has been filled with dynamite. The debate resumes. Stan continues to sink in popularity, until he hears the screams of Dipper and Mabel, who have moved the chair over to the nostrils and fell out. Their rope frays rapidly as Bud prepares to blow them up. Stan quickly forgets about the debate and rushes to save them, punching eagles as he climbs up the scaffolding. Impressed, the townspeople begin throwing birdseed at him, since the candidate with the most birdseed will be chosen by the freedom eagle as mayor. Stan grabs the kids just as the rope breaks and pulls them back into the statue. Infuriated, Gideon forces Bud to push the detonator. Stan grabs the kids and they leap out just in time as the statue explodes. They land safely in the pile of birdseed as the crowd flees. The freedom eagle leaves its cage and gives Stan a kiss, declaring him the new mayor of Gravity Falls. The townspeople cheer as Gideon throws a tantrum.
Stan's success is short-lived, however, as his criminal record has been discovered, disqualifying him from being mayor. Tyler is elected mayor instead. The news station begins to air Stan's criminal record in its entirety. Dipper is disappointed that Stan didn't win, but Stan is alright with it. Mabel gives him a sash she made that says "Our Hero", causing Stan to tear up a little. They all head off to vandalize Mayor Tyler's new mansion.
In prison, Gideon is doing arts and crafts with Ghost Eyes, who offers to let him join a riot that night. Gideon declines and returns to his cell. In his cell is a cat poster, which he removes to display a Bill Cipher summoning circle. He completes the circle by drawing an eye in the triangle, and says he's ready to make a deal as the circle glows.
- Additional Written Material by:
- With the Voice Talents of
- Kristen Schaal as Mabel
- Jason Ritter as Dipper
- Alex Hirsch as Grunkle Stan and Soos
- Cecil Baldwin as Tad Strange
- Jennifer Coolidge as Lazy Susan
- Keith Ferguson as Deputy Durland
- Linda Cardellini as Wendy
- John DiMaggio as Manly Dan
- Will Forte as Tyler Cutebiker
- Georgia Gillespie as Girl with Bow
- Stephen Root as Bud Gleeful
- Thurop Van Orman as Li'l Gideon
- T.J. Miller as Robbie Valentino
- J.K. Simmons as Ford
- Gregg Turkington as Toby Determined
- Kevin Michael Richardson as Sheriff Blubs
- Niki Yang as Candy
- Casting by:
- Mayor Befufftlefumpter's full name is Eustace Huckabone Befufftlefumpter.
- He was also raised by bears in the wilderness and raised the Gravity Falls water tower.
- He also may have started the first world war.
- Gideon kept a page from Journal 2.
- Tyler's full name is Tyler Cutebiker.
- Some of the crimes Stan Pines has committed include snacks evasion, pickpocketing, woodpecker baiting, impersonating a dentist, general indecency, golf cart theft, bingo fraud, telling overly long jokes and pug trafficking, among others.
- Robbie and Tambry continue their relationship first established in "The Love God."
- The death of Mayor Befufftlefumpter and Bud Gleeful's bid for his office were first referenced in cryptograms found in Dipper's and Mabel's Guide to Mystery and Nonstop Fun!.
- Gideon's imprisonment in adult prison from "Gideon Rises" is mentioned.
- Stan references his true identity as an unnamed grifter first revealed in "Not What He Seems."
- Journal 2's entries on the Mystic amulet from "The Hand That Rocks the Mabel," Possible Hiding Places from "Gideon Rises," and the Blood Rain from "Little Dipper" make an appearance.
- Bud's distaste for the supernatural from "Society of the Blind Eye" is referenced.
- Stan's attempts at teaching a bear to drive seen in "Bottomless Pit!" are referenced.
- The plot for this episode was accidentally leaked by both the iTunes and YouTube releases of "A Tale of Two Stans." This error was later fixed.
- The Watch Disney XD release had a similar error. It said "Grunkle Stan decides to run for mayor," which would be the Watch Disney XD description for this episode, but it appeared on the Watch Disney XD stream for "A Tale of Two Stans." It was later changed to match the plot of "A Tale of Two Stans."
- In anticipation for the episode, a Twitter account (@StanPines4Mayor) was created by Alex Hirsch for Stan's platform.
- In addition, a website created.
- When Gideon is reciting an incantation to possess his father, the spell is heard as something unintelligible. When played backwards he is actually saying, "Spooky evil spells! Spooky evil spells! Spooky evil spells! Spooky spells! Spooky spells!" 
- Judging by the way Bud reacts, it is possible that Gideon used the Possession Incantation spell before. Or this may suggest it can only be used on the same victim twice.
- The cryptogram in the end credits is CWZSQVQBEWZSQVQBEWZSQVQMPHKD'MZ!, which, when decoded with the Vigenère key WORKINIT, translates to GIIIIIIIIIIIIIIIIIIIIIIITTTT'EM! The key is found in the upper left corner of a Gravity Falls Gossiper newspaper article.
- The cryptogram in the episode's end page is 22-19 1-23-6-25 9-18 1-16-9-11 25-9-3 22-19-12-15-4-4-12-19 22-15-17 8-6-9-22-12-19-11-5 21-23-10 5-4-23-6-4 9-3-4 1-15-20-20-12-19 which, when decoded using the Combined Cipher, reads: BE WARY OF WHOM YOU BELITTLE, BIG PROBLEMS CAN START OUT WIDDLE.
Click here to view this page's gallery.