It's not the sensors or the body that knows if something is hot or cold. It's the brain. The sensors are activated, and the brain simply get's the message "sensor activated", and it simply collates all the information, from all of the different sensors, and matches it to memories that have built up as we are growing and learning from childhood.
I can remember years ago being at an ice-cream van, and a couple had a young baby, and they said "this is her first taste of ice-cream". They gave it to the baby to lick, and the little girl screwed up her face and said "hot !!!" Then, seconds later, she obviously decided she really liked it, and was kicking her legs and struggling to try to get another lick. It was funny at the time.