On the face of things, a hot waffle iron wouldn't seem to have all that much in common with a block of ice. But the two objects share the same capacity to inflict pain. Extreme heat and extreme cold are both able to deliver a nasty blow to human skin, and it turns out that the brain monitors these thermal extremes in similar ways.
We often think of the skin – and the nerves embedded within it – as being primarily responsible for the sense of touch, but what biologists refer to as "somatosensation" actually encompasses a broad range of senses.
Of course there's touch itself, or the recognition of mechanical stimuli by the skin, but there's also proprioception, or the ability to sense the body's orientation and position, and nociception, which is the body's ability to detect noxious stimuli. Feeling pain is the body's response to nociception.
Whether the painful stimulus is mechanical, chemical, or thermal, nociception motivates us to try escaping from it. Thrust your hand into a fire, and the resulting sensation of burning triggers your body to remove your hand as rapidly as possible. It might feel unpleasant, but pain is actually proof that your body is working hard to keep you safe. Lose the ability to feel pain and you're in real trouble.
"The basic principle," says Duke University neurobiologist Jorg Grandl, "is that the sensory neurons that project throughout your body have a set of channels that are directly activated by either hot or cold temperatures." By studying genetically modified mice over the last fifteen years or so, researchers have been able to prove that these channels – proteins embedded in the neurons' walls – are directly involved in the sensation of temperature.
Sunburn sensitises our heat-detecting channel, lowering the threshold at which we feel pain
The best understood of them is called TRPV1, and it responds to extreme heat. TRPV1 isn't typically activated until a stimulus reaches 42C (107.6F), which both humans and mice typically regard as painfully hot. Once your skin reaches that threshold the channel becomes activated, which in turn activates the entire nerve, and a signal gets transmitted to the brain with a simple message: ouch!
"For cold, in principle, the same mechanisms apply," Grandl explains, except the protein in question is called TRPM8, and instead of reacting to extreme cold, this channel instead activates upon exposure to cool, but not painfully cold, temperatures.
That leaves TRPA1, which is perhaps the least understood of this class of proteins. While researchers have found that it becomes activated in response to extremely cold stimuli, it isn't clear whether it's actually involved in the work of detection itself.
Together these three proteins – TRPV1, TRPM8, and TRPA1 – enable the skin to detect a range of temperatures and the body to respond accordingly. And because they're nociceptors, these proteins' job is to help you avoid certain temperatures rather than to seek them out. Mice with defective versions of the TRPM8 receptor, for example, no longer avoid cool temperatures. That means that mice – and us, probably – don't actively seek pleasant temperatures. Instead, they actively avoid both cold and extreme heat, which explains why they seem to prefer warm, balmy environments.
While researchers have defined the thermal boundaries at which these TRP receptors become active, that doesn't mean that they can't be modulated. After all, a lukewarm shower can feel excruciatingly hot if you've got a sunburn. "It's been shown that this is specifically because the inflammation in the skin sensitises the TRPV1 channel," says Grandl, lowering the threshold at which these nerves communicate the sensation of pain to the brain.
Why did plants evolve chemicals that activate the receptors otherwise activated by temperature?
But temperature isn't the only thing that activates these receptors; plants do it too. It might perhaps come as no surprise to learn that TRPV1, which is activated by extreme heat, is also activated by capsaicin, the compound that gives hot peppers their burn. And TRPM8 responds to the cooling power of menthol, a chemical found in mint leaves, while TRPA1 is also called the "wasabi receptor" thanks to its activation upon exposure to the noxious compounds in mustard plants.
Why did plants evolve chemicals that activate the receptors otherwise activated by temperature? As University of Washington molecular biologist Ajay Dhaka explains, capsaicin does nothing to TRPV1 in fish, birds, or rabbits, while it does bind to the same receptor in humans and rodents. "So maybe, plants evolved capsaicin to get some animals not to eat it, to leave it alone," while remaining palatable to other creatures, he says. Ostensibly, similar forces were at work behind the evolution of menthol and mustard.
In other words, these curious relationships between plants and temperature might reflect more about the evolutionary history of the plants rather than the animals. Perhaps the plants found a way to hijack our bodies' temperature detection abilities, evolving compounds that activate the same receptors as painful heat and cold by mere happenstance.
So the fact that we sweat when snacking on jalapenos isn't due to any inherent property of the peppers themselves, only a result of the fact that both capsaicin and heat activate the skin's nerves – and therefore the body – in the same way.
By taking advantage of a receptor that's already tuned to noxious stimuli, these plants found a sneaky way to avoid being gobbled up… at least, until we found a way to enjoy the painful burn of spicy foods and the eye-watering flavour of wasabi. So next time you notice your heart racing after eating a bowl of chilli, take a moment to reflect on the possibility that what you're feeling is the result of millions of years of evolutionary battle between plants and animals. A battle that, for the moment at least, we appear to be winning.
Join 800,000+ Future fans by liking us on Facebook, or follow us on Twitter, Google+, LinkedIn and Instagram
If you liked this story, sign up for the weekly bbc.com features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.