When eating spicy food, your body tricks you by acting the way it does when your body is overheating. That's why you might feel pain or start profusely sweating. Your body simply doesn't know what else to do. Just like other times where you may be overheating or in pain, your body releases endorphins to distract you, so you probably think you like the sensation.
Next time you find yourself in this predicament, make sure to reach for dairy, alcohol, and rice, but never water.