For anyone who wants to know about ice baths, it is the same logic behind why taking a really hot bath on a hot day is effective; if you raise your body's temperature above the air temperature, the air is cold, and vice versa.
Lowering your body temperature also has the effect of lowering your skin's sensitivity. So when you touch your body, the heat gives a massive burst of spreading warmth.
Note: Hugs are far too uncomfortably intense in this scenario.