The ice cream headache, often called a "brain freeze", is actually referred pain from the roof of the mouth which you feel coming from the temple area of your forehead when you suck cold beverages through a straw, sucking the liquid directly onto the palate. The drink doesn't get chance to warm up before it hits the roof of your mouth.
There were simple ways of avoiding the problem in the first place when ordering your ice cold beverage.
The simplest way when you are drinking through a straw is not to angle the straw in the direction of your palette.
Those who remember their manners and eat their ice creams slowly are much less likely to have a problem. (Source: telegraph.co.uk)