The spy hat causes you to no longer take burning damage, because as far as everyone else can tell, you might as well be on fire with an awesome hat like that.
The Heavy Football helmet protects him from headshots. It also gives him an "endzone dance" taunt, as well as a the ability to throw the intelligence like a football.
The Pyro hat gives him the ability to fly if he spins the little propeller thing fast enough.
The Scout hat eliminates the Sandman cooldown time for baseballs.
The Demoman afro gives him a Jive-Talkin' accent, and replaces his bottle with a bud of completely legal herbs.
No, all the hats are completely cosmetic. I'm just messing with you
guys.