The invisibility hats are one of the Glooms' many instruments of misdeeds. Their only appearance so far is in "Surprise".
Anyone who puts the hats on become completely invisible to anybody who isn't wearing an invisibility hat themselves. The hats don't make the user intangible though. This allows one to perform tasks while being completely undetectable. This does imply though that the hats can be knocked off even while they are in use and the moment the hat comes of the wearer's head, the effect wears off as shown when Grim mockingly tipped his hat off to The 7D after stealing their party supplies.
In the show
In "Surprise", the Glooms use the hats to walk through Jollywood without causing a ruckus and spy on Lord Starchbottom's affairs. The Glooms then overhear about Queen Delightful's surprise party. Later, Grimwold uses his hat to spy on the 7D's party preparations and steal all the party stuff. The 7D are able foil him in the end.