My wifes car was doing this the other day. It went cold while stopped, and heated back up as the car was moving.
Yesterday I put in more coolant, as she was low (really low actually), and she said it worked. I'll have to see again today to make sure it's fixed. So, check the coolant.