Could be multiple problems,
Coolant Temp Sensor, Fan Switch....I suggest you don't drive the car until this problem is fixed, you don't want to warp the head.
EDIT: Thermostat should be good, since you stated that when you turned the heat on it cooled off.