Cold-sensitive magic pen
The ink you describe is an example of a leuco dye, which are molecules that exist in colored or non-colored states depending on what they're interacting with and under what conditions (temperature, pH, electronic environment, etc.). 

For the ink system, you need 3 components: the electron-donating leuco dye molecules; the electron-accepting molecules (the developer); and a matrix of compounds that stabilize the reaction of the first 2 components for a range of temperatures (meaning the reaction is favored one way above a certain temperature, and another way below a certain temperature).

There is a simple graphical explanation from the notable pen company Pilot, part of which is below. Note that their system uses microcapsules that interact with other molecules in the ink in certain temperature ranges that result in either colored or transparent ink. In the diagram, A is the leuco dye, B is the developer, and C is the stuff that stabilizes the reaction of A and B over a temperature range.



This detailed patent application for "Thermosensitive decolorable ink composition" details the physical and chemical processes involving formulations of leuco dyes. When you add heat to the ink by erasing, the non-colored form is present. When you cool it down, you are letting the system revert to the colored form and the ink reappears.