After the pirates escaped to Ventureland, they broke the contraption to stop Hook's new crew from pursuing them. Tiki Sam grabbed one of the pieces, the wheel, as revenge for the pirates looting his shop.
Sam will trade the Wheel to Mickey for his collection back. Mickey can then find the three masks and Sam will happily give the mouse the Wheel along with discounts on everything in the store.
However, If Mickey takes the "cheating" path (by stealing the masks out of the storeroom and then re-giving them to Sam), the dog will still give Mickey the Wheel, but if Mickey goes overboard (pardon the pun), Sam will realize what the mouse is doing and will give him the Wheel angrily and cancel the discount.
After it's given to Smee, the Wheel will be in its place in the contraption (connecting two gears on the side of the waterwheel) for the rest of the game.