Bob stays with Cecil (who is Springfield's chief hydrological and hydrodynamical engineer). The brothers had not spoken for ten years, due to Bob unintentionally taking the role of Krusty's sidekick, while Cecil had wanted the part since he was 5.
Cecil plans to build a dam on a river (which flows through Springfield) and appoints Bob a job to help with the construction. While Cecil is showing Bob the site, Bob sees Bart spying on him from the other side of the river. Bob, unaware that Bart is spying on him, waves and shouts, "Hello, Bart!" This prompts Bart to hide in the bushes. Bob then explains to Cecil that Bart is just shy because he has tried to kill him so many times. Bart proceeds to follow Bob around due to his beliefs that he is evil. Bart even ruins Bob's date with Mrs. Krabappel, where Bob says that "You only get one chance with Edna Krabappel." During the construction of the dam, Bob complains about his workers (Cletus and a bunch of his relatives, especially after an incident where one of the workers, Merl, ended up accidentally encasing his dog Geech inside cement), several of the supplies utilized being misused or shoddily made (the portapotties being used as a makeshift smokehouse instead of their intended use as portable toilets, as well as the overalls being shoddily made so that the posterior ends up opening up like a hinge) and Bart (who is spying on him at work), and curses the dam, wishing it "would burst and bury this accursed town."
Bart persuades Lisa to help him uncover Bob's plot. They go through Bob's trash, and they are caught. Bob brings them back to their home, where he tells Homer and Marge that if he catches Bart again, he won't be held responsible for his actions. Bart and Lisa go to the construction site and search his trailer, where they find a briefcase full of stolen money. Bob discovers them in his trailer, and chases them through Springfield Dam until they reach the turbine room, where the kids question him about the money. He denies any knowledge of it. Cecil shows up and reveals the money is his: he embezzled the money by cutting back on construction, and he plans on framing Bob for it, mostly because the latter got to be Krusty's sidekick instead of the former. He then locks Bart, Lisa and Bob in the turbine room and prepares to blow up the dam.
Bob helps Bart and Lisa (Bart is reluctant at first but is convinced that Bob isn't evil) escape. Bob and Lisa try to disarm the dynamite, and just before Cecil pushes the plunger to blow up the dam, Bart jumps on his back, saying, "Guess who." Cecil replies, "Maris?" Bart then hits Cecil with his own hard hat. During the struggle, Cecil's briefcase flies open and all of the money falls into the river. Cecil grabs Bart and throws him off the cliff. Bob saves him by swinging on the dynamite cord. As Cecil tries to blow up the dam a second time, Bob cuts the wire, preventing its destruction. The two plummet to their death, until Bob lands groin first onto a drainage pipe, where Bart climbs onto a section of the dam and helps Bob up. Bart then asks Bob if he'll stop trying to kill him, and Bob replies in a sinister tone, "Oh, I don't know about that..." and in a normal tone, "I'm kidding!" The two climb back up the dam while the police arrive.
The police arrive and Cecil is arrested. Bob gloats over his victory and how he's gained the respect of Bart and Lisa, but then Chief Wiggum arrives, believing Bob was involved, arrests him as well even though Lou said he wasn't, which nearly got him busted down to sergeant, which he already was. After being placed into the police car, Cecil tricks Bob into swearing revenge on Bart for not defending him. Bob falls for it, and upon realizing that he just made Bart his enemy again, Bob gets angry at Cecil for making him look crazy.
Despite Bart, Lisa, and Bob foiling Cecil's plans, the dam does break and flood the town, but no major damage is done. In the jail cell, Bob and Cecil squabble over who gets the top bunk. Bob wins when he pushes Cecil onto the floor. Cecil then asks him when they get their menus.