The episode begins with a short Patchy the Pirate segment. Patchy tells the audience that they will be watching his favorite episode, ”Shanghaied,” but Potty shoots him out of a cannon.
The SpongeBob SquarePants episode starts with SpongeBob at home opening a box of cereal (Kelpo), labeled as having ”One of eight essential prizes inside.” He pours out the whole box, but cannot find any prize. Suddenly, a giant anchor crashes into SpongeBob’s house, which SpongeBob then believes to be a ”baby” from the sky. He and Patrick alert Squidward that the sky had a baby, and he explains that it is a giant anchor. Suddenly, the anchor moves, crashing into Squidward’s house as well. Squidward begins climbing up the anchor’s rope to complain to the owner, and SpongeBob and Patrick follow. They find out that the anchor was dropped from the Flying Dutchman’s ghost ship. When the trio set foot on the ship, the Flying Dutchman emerges from his cabin, terrifying Squidward. SpongeBob and Patrick tell the Dutchman of Squidward’s intentions to complain to him, and he repeatedly burns Squidward with fire from his nostrils (and eyes). He tells SpongeBob and Patrick that ”you’re next,” and they attempt to jump over board, but land back on the ship every time with the Dutchman welcoming them back. The Dutchman then tells them that for setting foot on his ghost ship, they shall be forced to work as his ghostly crew for all eternity.
Squidward proceeds to complain about this, and the Dutchman throws him into a zipper-like portal to a chaotic dimension, called the ”Fly of Despair.” The Flying Dutchman then has SpongeBob and Patrick help him go around Bikini Bottom and scare people. However, they cause more harm than good for the Dutchman, who then tells him that he has decided to eat them instead. He locks them in their room, as he prepares for his dinner. SpongeBob and Patrick reluctantly decide to escape through the ”perfume department,” where perfume is constantly getting sprayed in their faces as they walk through it. After getting through the perfume department, they steal the Flying Dutchman’s dining sock, which he cannot eat without. The Flying Dutchman catches the two as they try to escape. SpongeBob and the Flying Dutchman begin fighting over the sock, until the Flying Dutchman decides to grant them three wishes in exchange for it. Patrick wishes he knew about this earlier, thus wasting the first wish. SpongeBob wishes that Squidward was here to see this. Meanwhile, Squidward, after passing through the Fly of Despair, is dropped into his bedroom, but is then immediately transported back to the Dutchman’s ship. The trio begin arguing over who should get the last wish, until the Dutchman gives SpongeBob the last wish. SpongeBob wishes that the Flying Dutchman turns into a vegetarian. SpongeBob and the others are turned into fruit and are chased by the Dutchman who is now a hippie. The episode itself ends and Patchy returns to greet the audience. After a totally random outburst in which he tells the audience to walk the plank, he announces that they are going to read a fan letter. Unfortunately, Potty shows up with a fuse in his head from an evidently unplanned explosives stunt. Potty and Patchy are blown up and Patchy decides to sign off the show.