What causes an ice cream headache?

Hold an ice cube in your hand. It feels cold against your skin, right? Imagine that same cold feeling spread out, but localized within your skull. In my experience it’s not awful, but it is pretty darned uncomfortable. As I got older I noticed I had them less and less. I don’t know whether that’s because my head got bigger or I just learned to slow down when eating ice cream. Or maybe both.