Actually there is a cure. When I was told about it I thought the person telling me was full of crap, but I tried it and it worked.
The nerve that is affected can be suppressed by pressing your tongue as hard as you can against the roof of your mouth. The ‘brain freeze’ or ‘ice cream headache’ goes away very quickly.
mikebrowne is pretty much right. Its all about getting the blood that’s ciculating through your brain to a reasonable tempature. Whichever means works best for you.