Thanks to a radio talk show host, Mayor Quimby is pressured into releasing Sideshow Bob from prison. Once out, Bob promptly runs against the mayor and wins. Bart and Lisa set out to prove Mayor Bob did not legally win.
Sideshow Bob calls up Birch Barlow, a local right-wing talk show host, stating that he is being treated unfairly in prison. Thanks to Barlow, all of Springfield sympathizes with Bob, except for Bart, Lisa and Marge. Pressured by protests, Mayor Quimby releases Bob.
At a Springfield Republican meeting, Bob announces his candidacy for mayor of Springfield. Determined to prevent the psychopath from becoming mayor, Bart and Lisa help campaign for Quimby. Quimby helps obtain the old folks' votes by naming a new expressway the "Matlock Expressway". Bob then steals the support of the old folks by promising to build the Matlock Expresswayand spending the rest of the afternoon listening to all of their problems. Unfortunately, at a televised debate hosted by Larry King, and broadcast on FOX, Quimby has the flu, and tries to counteract it with extra-drowsy flu medication. Springfield (infamously including Homer Simpson and Krusty the Clown) casts its votes for mayor and the results are 100% for Bob and 1% for Quimby (and there is a one percent margin of error).
The next morning, in a slight reference to Douglas Adams's "The Hitchhiker's Guide to the Galaxy", the Simpsons wake up to construction occurring outside (which Homer mistakes for the Rapture). Bob informs the family that the Simpsons's house is in the way of the new Matlock Expressway and that it will be demolished in 72 hours, along with any remaining Simpsons. While Marge attempts to fight off their home from being demolished, Bart and Lisa begin to suspect that Bob somehow cheated in the election. Lisa rifles through all the voter records but to no avail. Under Bob's orders, Bart is transferred to kindergarten (which he actually enjoys). While Lisa reviews the records, she falls asleep and someone discreetly leaves a message for her. Bart and Lisa go to a parking garage to meet with the whistle blower, while Homer furiously reads an Archie comic book, still angry with the gang for kicking him out of Riverdale. While trying to remain anonymous in the cover of shadow, Homer unintentionally exposes Waylon Smithers with the help of the headlights and of which he openly greets him. This action albeit unintentional, angers Smithers for he wanted to help the kids in secret and since Homer is here, he can drive him home. While driving Smithers home, he admits he hates to go behind Mr. Burns' back, but he feels that some of the laws Bob passed conflict with his [Smithers'] "choice of lifestyle." He gives them one name of a person who voted for Bob as a hint, and Bart and Lisa soon discover that most of Bob's votes came from dead people and their pets (this includes the Simpson's family cat, Snowball). However that just once piece of evidence, as Lisa discovers that Homer had only voted for Bob out of forgiveness and spited Bart for sending him back to jail, even when they warned him in the past about Bob's past attempt to kill their aunt, Selma. She also discovers that Krusty also voted for Bob out of greed because of the tax-cut policies Bob promoted.
At the trial, Bart and Lisa appeal to Bob's ego to get him to confess his crime by saying he isn't intelligent enough to have pulled it off and that he was just Barlow's lackey. However, Bob is smart enough to understand reverse psychology and angrily confesses his crimes along with the fact Barlow was working for him. He even produces the evidence in why he did rig the election after uncovering Quimby's own corruption and lack of leadership: Bob wanted to save the Springfield residents from themselves by lowering taxes and keeping criminals behind bars. He realizes his mistake too late, when Judge Snyder calls for him to be arrested. He is thrown into a minimum security prison, thus managing to let the Simpsons have their house back, letting Quimby regain his term as mayor, and putting Bart back into the fourth grade (much to his dismay, as he was enjoying being back in kindergarten).
Back in jail, Bob swears revenge on Bart once more, but his anger is stalled when an inmate from Yale asks him to row for them in order to beat Princeton. Finding a new goal, Bob rows to help the inmates beat the Princeton alumni.
On the original 1994 airing of the episode, the episode aired with the common title-driveway-couch-credits opening, while using the Eyeless Family couch gag from Boy-Scoutz 'n the Hood. However, on its sole 1995 repeat and on the Season 6 DVD, it went right from the title into the credits, while also using the Season 3 version of the theme song, despite being a Season 6 episode. In syndication, the episode aired instead with the infamous Duplicate Family couch gag, making it longer than the 1995 opening, but shorter than the 1994 opening. It is currently unknown why this change occurred.