Toyota Repair: Knock sensor/ problems with surging, sensor problems, toyota pickup


Question
I'm driving an 1993 toyota pickup with an sr-22e engine, manual transmission, with about 189,000 miles on its engine.I'm having a couple of problems-- the first is the oldest.  When the car is stopped at an intersection and idling, the idle speed drops and surges.  The idle also seems high at times, when I start it in the morning, and at other times, it seems low when I start the truck in the mornings.  The problem with the "surging" tends to occur after driving the car for a little while, when it's warm.  

The other problem is associated with what I believe is a knock sensor.  When attempting to change my oil recently, I hit a wire with the handle of the oil filter wrench and pulled it from the back of the sensor.  I stuck the ferrule back into the sensor, thinking that the problem would be an easy repair.  BUT, the engine light is on and the car is making some frightening, clattering, as if a cookie sheet were resting on the engine.  Any help?  Thanks, Levi

Answer
The surging may be from low coolant, when air in the coolant hits the temp sensor passage it changes the signal to the ECU and it searches for the correct idle.
jack the front of the truck up to make the radiator neck the highest point and slowly top off the cooling system until full.

check the sensor itself for damage and try to make a better repair at the connector,
Discionnect the battert for a few mins to clear the computer and see what happens,

Mike