The Simpsons receive a letter about a free spa get away and they decide to go to it. Homer is nearly killed when he is locked in a very hot spa room with a wrench, by a mysterious man. After Homer barely managed to survive the incident (He was saved by Krusty the Clown, who just so happened to be going into the same spa room), he and Marge visit Chief Wiggum, who suggests they use a psycho to help find Homer's killer. After walking down a corridor to a separate prison cell, it is revealed that Sideshow Bob is isolated from the others, as he is the craziest. They decide that Bob should be temporarily released from jail, to help work out the criminal's identity. This discomforts Bart greatly but Chief Wiggum places a shock device around Bob's ankle (he cannot remove it, as it is taped to his leg hair), which enables the Simpsons to shock him if he attempts to kill Bart (or for any other reason, such as being smart).
Bob asks Homer who may want to kill him and decides to follow Homer around for the day. During the day they go hang gliding (in an attempt to impress Bob), visit the Kwik-E-Mart where Bob remembers that his one successful crime was when he robbed the store dressed as Krusty and Homer buys a copy of 'Jugs & Ammo', and then they go to a garage after Homer's car is totalled, where Bob says "Well, we've settled that argument. You can't read a magazine and drive." Homer criticizes his mechanic, Junior. Next Homer takes Bob to Moe's Tavern, where Bob makes a picture of Bart's face on the dartboard using the darts, and Homer is shot at but the bullet misses and hits Moe's pickle jar. The criminal escapes in a tow truck.
While in the kitchen inspecting the envelope on Homer's spa invitation, Bob discovers a black smudge. This appears to be a big deal until Bob reaches for the remote to his shock device, only for it to be snatched away by Bart. Bob states that he thought he could get it while it was on the recharger. Bart shocks him and Bob cries, "I...was wrong!" and falling facefirst onto the table. Bart states, "I don't know how we ever had fun without him."
Later, Bob is sitting on the couch watching That '30s Show with Maggie. Bob states,"Tom Shails gave this show a good review. And I'm the one in prison!" Marge and Homer interrupt him, asking if he's made progress towards finding Homer's killer. Bob says that he hasn't and tells her to just go ahead and shock him. Marge doesn't pass the opportunity and says,"Maybe just a little one." She presses the button, but then it gets stuck and she has to bang the remote against the wall for it to stop. Bob then suggests to Homer that he stay at home to stay safe, but Homer is appointed King of the Springfield Mardi Gras, where he must ride a float for the whole day. Bob then discovers Homer won because someone stuffed the ballot box with his name, but Homer still takes part in the fair.
During the parade, Bob realized that Homer's engine is having a problem (the brake line is cut). Bob then works out that the wrench (this was used to jam the steam room door), wrenches in the tow truck. A shot intended to hit Homer misses. Bob and Homer chase the culprit into an alley, where they discover it is Homer's mechanic, Junior. It is revealed that he was trying to avenge his father'sdeath, who was driven to his death when Homer caused him to have a nervous breakdown. When Homer questions how Frank Grimes Sr. could've had children if he wasn't married, Junior explains, "He happened to like hookers, okay!?" Lisa, Marge, and the police show up with the 'identity' of the culprit. Homer informs Lisa that he already knows that it is Junior. Lisa then agrees with him, despite the fact that they thought his assailant was Bumblebee Man, and the police arrest Junior.
Back in the Simpsons house, Homer says good night to Bart and leaves. It is revealed that Bob was hiding behind the door and has thrown the remote to his shock device out the window. Bob decides to take some advice from Lenny and kill Bart without delay. Bart tries to scream for rescue but he is gagged with tape. However Bob cannot perform the deed so he then sings that he has become accustomed to his face, Bart removes his gag (as he has not been tied up) and tries to sing with him to soften the mood, but Bob tells him that "this isn't a duet" and forces Bart to re-gag his mouth. As he jumps out the window he is shocked by birds in a tree, who have gotten a hold of the shock remote.