Empire Wall Heater

I have an old Empire Wall Heater. The unit has an external Thermostat. The wires from the Thermostat do to some type of standard transformer, which I have replaced. The wires leave this transformer and go into some other electrical device that is attached to the Gas Valve. I believe this electronic device is bad as there was a loud clicking noise coming from this part. The pilot lights but when I turn the pilot knob past pilot to low or high the flame goes out. Something it shutting it down when I turn the pilot vale to on and it must be this device. When plugged in, this device makes a humming noise. Any help would be greatly appreciated