PlotDriving along some back roads on the way to a rock festival, the Mysteries Inc. gang become lost and stop to ask directions from a local farmer. He directs them to the interstate but warns them to take the long route, as the short route will take them past the "haunted mansion" where the "headless specter" lives. But the Mystery Machine is low on the gas, so the gang is forced to take the short route; the van overheats and they stop in front of the mansion. Scooby and Shaggy go to fetch some water but are frightened away when a ghost floats out of the well. Seeing a light in the mansion, the kids go to investigate. Inside the mansion they are chased by a floating candle, and Shaggy and Scooby are spooked by a painting of Jefferson Stillwall: the head disappears and reappears. The gang hear a knocking sound and go to investigate. In an empty room they find a box (left behind by the headless specter, which has been stalking in and out through hidden passages). Inside the box they find the head of Jefferson Stillwall—it is, however, made of wood, and the gang only become more determined to investigate. They spot footprints in the dust on the floor and follow.
The footprints lead off in two different directions, and the gang split to follow. Velma, Shaggy and Scooby stumble through a dark room and come out holding hands with the specter, which chases them about the house; they escape but fall down into the well, where they discover a hidden passage. Back in the mansion, Fred and Daphne find an old diary whose last entry (from 1822) carries an enigmatic message: "Marching men in single file hide the secret. Stillwall shows the way." As they exit the bedroom, they find a trapdoor that leads down into a fruit cellar, where they run into the others. Shaggy and Scooby find that the jars are filled with rubber balloons, and Velma uncovers a canister of helium. That explains the ghost seen earlier: it was a balloon covered in a sheet.
Velma deduces that the "marching men" in the diary passage must refer to a line of columns and that the painting of Stillwall should be pointing to a particular column. But the painting points to the greenhouse. Shaggy and Scooby investigate; they find a lily flytrap and the specter, which chases them. They wind up in the well and use balloons to escape. The specter chases them, and all three crash into a henhouse. The specter is revealed to be Penrod Stillwall, descendent of Jefferson Stillwall. He explains that he concocted the legend of the haunted house so as to scare people off while he searched for the family treasure. They all hear the knocking sound again. Fred and Shaggy investigate and find a strange figure in a sheet chopping up the walls of the attic. It chases them but they capture it. It is the farmer, who was also searching for the hidden treasure. Scooby finds the fortune hidden in a column that Shanks knocked down when he was captured. Stillwall takes the fortune, and the kids set off for the rock festival.