What Causes Brain Freeze?

That terrible pain the befalls us when enjoying an icy treat! How does that happen? Is there a cure?