Unless he agrees to give it back to you, you can try submitting a ticket to Steam Support. They have the ability to put the hat back in your inventory (but apparently they can't give you the same effect on unusuals, as those are generated at random when the hat is created, and Valve can't manually set those). I've heard some stories about Valve fixing problems like these, but keep in mind that they aren't obligated to do so in any way, so if they do it, that's just a professional courtesy they're offering. If they don't, then there probably isn't any real recourse for you, unfortunately.