How does brain freeze occur?

As a neuroscientist, biochemist, and German Science Slam champion, Henning Beck explains a wide variety of scientific phenomena. He can be heard in a duo with professional quiz player Sebastian Klussmann on the podcast "Klussmann and Beck – The Duel of the Know-It-Alls."
"Brain freeze is a cold headache that occurs when we consume cold drinks or ice and these come into contact with the roof of our mouth. Similar to a migraine, it is the sensation of a stabbing headache. The trigeminal nerve in the visual field, also called the trigeminal nerve, transmits this sensation of pain and, in extreme cases, causes watering of the eyes. Because the brain cannot precisely localize the phenomenon, it is not the roof of our mouth that hurts, but the front of our head.
The speed of food intake and the temperature are crucial: Brain freeze occurs when food below freezing is consumed very quickly. To maintain body heat, the blood vessels in the roof of the mouth initially contract in an overreaction. To prevent them from becoming too constricted, they suddenly dilate, causing more blood than desired to flow to the brain. This leads to a stabbing pain. The temperature in the mouth should be brought back to normal quickly. It can help to press the tongue against the roof of the mouth, quickly swallow the ice, or drink something warm. If the pain is extreme, a finger can also be placed on the front of the lip. The faster the temperature normalizes, the faster the pain subsides. The discomfort usually lasts only a few seconds, at most a few minutes.
Long-term negative effects are not expected, but people who are already prone to headaches are more likely to suffer from brain freeze pain. This can be observed, for example, in migraine sufferers."
süeddeutsche