The Simpsons hire Sideshow Bob to help them find out who keeps trying to murder Homer.
While the Simpsons are at a free spa getaway, Homer is almost killed by a wrench while locked in an extremely hot spa room with a mysterious man. After being saved by Krusty the Clown, he and Marge visit Chief Wiggum, who suggests they ask a psycho to help them 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 agree 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 device around Bob's leg which will shock him if he tries to kill Bart.
During the day, Bob and Homer go hang gliding (in an attempt to impress Bob), visit the Kwik-E-Mart (where Homer buys a copy of Jugs & Ammo and Bob remembers that his one successful crime was when he robbed the store dressed as Krusty), and go to a garage after Homer's car is totaled. Next Homer takes Bob to Moe's Tavern, where Bob makes a picture of Bart's face on the dartboard using the darts. 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. 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 presses the button, but it temporarily gets stuck. 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 discovers that the brake line in Homer's engine is cut and there are 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, who is actually the son of Homer's deceased co-worker Frank Grimes and was trying to avenge his father's death. When Homer questions how Junior's father could've had children if he never married, Junior explains, "[My dad] 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 she thought his assailant was Bumblebee Man, and the police arrest Junior.
Back at 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 agrees to take some advice from Lenny and kill Bart without delay. Bart tries to shout 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 regag his mouth. As Bob jumps out the window, he is shocked by birds in a tree that have the shock remote.