Open the folder of whichever hat you wish to replace, then drag both the materials and models folders inside the hat of your choice into your \team fortress 2\tf\ folder.

If you wish to use the alternate versions, be sure to do the above, and then pick whichever alternate version you want to use, and drag the materials folder into the tf folder, replacing everything.