At the docks, the boys inspect the preparations for the "Halloween Haunt" but deem it gay with Cartman too busy looking forward to Christmas. Priest Maxi tries to inform people about the evil of Halloween but is ignored. The boys bump into the 5th Graders who terrorize them with the story of the pirate ghosts. The boys try to come up with a way to scare back the 5th Graders, and decide to dig up Kyle's dead grandma, Cleo Broflovski. They do this and hide her at the docks, however a dog comes and takes her away, unbeknownst to the boys. The wardens at Mount Peaceful Cemetery inform Sheila Broflovski of the defiling of her mother's grave and suspect it to be the work of necrophiliacs.
Meanwhile, the band Korn is driving around and decides to play a game to pass the time. They end up getting scared when they see pirate ghosts and crashed their van by driving it off a cliff, landing in South Park. They show up and tell the boys about their encounter with pirate ghosts on their journey. The boys explain they're trying to get back at the 5th Graders since it is seemingly their work.
At the town hall, a meeting is held outside where the wardens of the cemetery consult everyone about the necrophilia. Suddenly, a pirate ghost ship appears in the sky along with three pirate ghosts who begin to kill the crowd. They soon vanish after warning everyone not to go to the docks. Priest Maxi then shows up and explains he was right about how the bandmembers are evil devil-worshipers, so it is their fault. The town then decides to drive Korn out of town.
Later on the boys show up in Halloween costumes (Stan as a cowboy, Kyle as a clown and Kenny as the ED-209 from the film RoboCop), except for Cartman who has his "Christmas present", an Antonio Banderasblow-up doll. Korn is then run off by the townspeople and soon discover they have a mystery to solve. They theorize that the pirate ghosts may be linked to the disappearance of Kyle's dug up grandma, who is not where the boys left her. They split into two teams and begin to seek the truth. One team decides to set a trap, but the other team are trapped in it instead after encountering the pirate ghosts. The townsfolk suddenly burst in and the pirate ghosts appear. Korn use their "Korn powers", which are turning themselves into variations of corn, but they are ridiculously useless (but it looked cool, according to Korn). However, they are able to catch the pirate ghosts in a net. As the true identity of the ghosts are about to be revealed, they disappear, suggesting they really are pirate ghosts. Then Korn's pet Nibblet opens a trap door uncovering the true villain, Priest Maxi. Although that case is solved, the whereabouts of Kyle's grandmother are still unknown until the aforementioned dog shows up and vomits up Kyle's grandma's corpse.
In the end, Maxi is arrested, the town invites Korn to stay and perform at the concert and the boys scare the 5th Graders with the corpse. Nibblet pops Cartman's doll (causing him to chase Nibblet and scream that he is a "Son of a bitch chicken from outer space"). Kenny, despite his bipedal robot war machine "costume", fails to win the costume contest and loses to Wendy Testaburger in her recycled Chewbacca costume from Pinkeye. Soon after his loss, he's taken down by small space fighter things, in homage to the walkers from Star Wars (In the abridged version, he just lowers the arms of his walker machine in disappointment at losing and the credits start).