Brain freeze, medically known as sphenopalatine ganglioneuralgia or cold- stimulus headache, is caused by the rapid cooling and rewarming of the blood vessels in the roof of the mouth (palate). When something cold touches the palate, it causes the blood vessels there to constrict (narrow) suddenly and then rapidly dilate (widen), triggering pain receptors in the surrounding nerves. This nerve pain is then interpreted by the brain as a headache, often felt as a sharp or throbbing pain in the forehead area due to referred pain via the trigeminal nerve. The brain freeze usually lasts a few seconds to a couple of minutes and is an unpleasant but harmless sensation.
The underlying mechanism involves a sudden increase in blood flow and resistance in brain blood vessels, particularly the anterior cerebral artery, which is thought to play a role in generating the pain. The brain reacts to the cold stimulus in the mouth by this vascular response to protect itself, although the exact detailed physiology is still being studied.