There are multiple ways to repair a heating thermostat, and the correct way depends on the nature of the malfunction. If the thermostat is not controlling the temperature, it may require cleaning or adjusting the wiring. If the temperature fluctuates greatly, the heat anticipator may need to be adjusted.
If the thermostat is not controlling the temperature, turn off the heating system, and then remove the cover to the thermostat. Next, use a vacuum or soft brush to clean the dirt and dust inside the thermostat. If it has parallel metal strips, wipe them both with a soft cloth. If corrosion is inside the thermostat, try removing it with an electronic contact cleaner. If this doesn't work, replace the thermostat. If the thermostat is not electronic, use a bubble level to ensure it is mounted levelly. If the thermostat is in a corner, a closet or near a door, window or heat source, relocate and rewire it, contacting an electrical contractor as needed.
If there are major swings in temperature or if the furnace cycles on and off quickly, the heat anticipator may need to be adjusted. Remove the thermostat cover, and adjust the anticipator lever as needed: if the furnace turns on and off frequently, move it one mark closer towards the longer setting.