Set inside a medieval castle, the story centers on Peewit, Michel Modo, the court jester, whose lighthearted mischief becomes the doorway to a surprising magic. A traveling merchant arrives to sell instruments to Peewit, but the King Georges Pradez dismisses him before Peewit even appears. The merchant leaves behind a flute with only six holes, which the King tosses into the fireplace, letting green smoke curl through the room. When the fire dies down, Peewit retrieves the flute, cleans it, and quickly discovers its power: whenever it is played, the entire castle bursts into dance.
That night, a man named Matthew McCreep learns from the merchant that the very flute he’s been seeking rests at the castle. He arrives to steal it from Peewit. To retrieve it, the King sends Peewit and the young knight Johan William Coryn to pursue McCreep, who uses the flute to rob people and to derail his pursuers with a sharp, sweeping melody. Their chase leads them to the house of Homnibus Henri Crémieux, and the wizard’s Hypnokinesis spell sends Johan and Peewit into Smurfland, where the legend of the magical flute begins to unfold.
In Smurfland, a Smurf guides them to the village, and Papa Smurf himself greets the travelers. They learn they must craft a new flute to counter McCreep’s effect. The Smurfs, led by Le Grand Schtroumf Michel Elias, dive into the forest and carve out a flute from the heart of a massive tree, believing this strongest wood will yield the right magic. The group joyfully celebrates a victory party, but just as Papa Smurf is about to hand over the finished instrument, the spell-weary journey sends Johan and Peewit back to Homnibus’s workshop, where the wizard reluctantly attempts the magic again and then collapses from a headache.
Meanwhile, McCreep has swelled his haul to over 7,000 gold pieces and visits his secret partner, Earl Flatbroke, to reveal a plan: hire an army on an island to wage war against the King’s castle. Two Smurfs who overhear the scheme slip away. Back at the wizard’s house, the Smurfs regroup with Johan and Peewit and bestow the magic flute upon them. The team heads for Terminac, where McCreep sets sail toward the island, though they arrive too late to stop him from initiating the voyage.
Flatbroke’s castle becomes the next focal point as Johan crafts a cunning plan by sending a letter to Flatbroke to lure him to the island. Flatbroke boards a ship at Terminac, and Johan and Peewit—disguised with Papa Smurf and others in tow (Brainy among them, though not named here)—tail the convoy. On the island, Peewit and McCreep meet again in a flute duel; the two exchange notes and push each other to exhaustion, but Peewit delivers a final, decisive note to knock McCreep out.
With McCreep and Flatbroke captured and the stolen money recovered, Peewit now holds two magic flutes. Johan warns that these instruments are dangerous and must be returned to the Smurfs, but Peewit decides to fashion a phony flute to hand over instead. Back at the castle, the real flutes are returned to the Smurfs, who depart. Peewit, left in possession of the flute, begins to play again, only to discover that it has no effect on the townsfolk—the genuine flute is useless here, and it is the counterfeit flute he had crafted that actually works, much to his frustration.