Anyone who's ever eaten ice cream too fast knows the pain of "brain freeze." Now researchers say they not only know why it happens, but that their discoveries could lead to treatments for more severe headaches like migraines.

In studying about a dozen healthy adults, scientists found that the pain linked to having something cold hit the roof of your mouth is caused by swelling and constricting of the anterior cerebral artery in the brain. The pain comes on when blood flow increases, and goes away when the artery constricts.

“The brain is one of the relatively important organs in the body, and it needs to be working all the time. It’s fairly sensitive to temperature, so [expanding arteries] might be moving warm blood inside tissue to make sure the brain stays warm,” said lead researcher Jorge Serrador of Harvard Medical School.

The "brain freeze" phenomenon is ripe for study because it's brief, relatively harmless, and can be examined from beginning to end. Some doctors think the same blood flow changes could be responsible for migraines and post-traumatic headaches, but others disagree.

“We have known for decades that migraine is caused by nerve dysfunction. There may be vascular changes, but they are only secondary,” said Dr. Teshamae Monteith, director of the headache program at the University of Miami’s Miller School of Medicine, adding that migraine warning signs like food cravings and fatigue indicate the headaches are linked to brain dysfunction rather than blood flow.

More From TSM Interactive