Usually, this is caused by a bad ground from the harness to the top of the thermostat ground that is transferred through the bolts securing the thermostat. Create another ground from the thermostat housing to the block or another ground and it should stop.