Overview
Ice cream headaches are brief, stabbing headaches that can happen when you eat, drink or inhale something cold. Biting into an ice cream cone is a common trigger, but eating or drinking other frosty items, such as ice pops and slushy frozen drinks, can have the same "brain-freeze" effect.
Officially known as cold stimulus headaches, they can also occur when you suddenly expose your unprotected head to cold temperatures, such as by diving into cold water.
The good news: Most ice cream headaches are gone as quickly as they develop.
Source: http://www.mayoclinic.com