I recently bought a Manual 97 Mazda Lantis 323 1.8L DOHC 16 Valve BP.
I found the following wire unplugged on the drivers side of the engine, next to the water intake from the radiator:
It plugs into the grey connector with the gold base. I plugged it in and the car wouldn't start. So I unplugged it and was able to get it to start after giving it some gas, but now the idle is erratic, falling almost down to around 200 and then jumping back up to 1000 ( previously it was fast idling just below 2k) . The engine also has a clear shake as if the timing on the pistons has gotten screwed up. I've also got a red light with an explanation point in it on the dash to the left of the speedometer.
A little history: the car had a head and ring job a few years ago, and the throttle body was replaced six months ago with a TB from an automatic due to idle and stalling problems. Not sure if the original TPS was kept or not. Previous owner claims he drove every day with no problems since then, but the first day I had it I noticed it idling around 2k after the engine warmed up and revving caused black smoke out the tail pipe. Getting about 10 mpg.
EDIT
After finding a repair manual online I think that that thing in the picture is the Water Thermosensor. I'm wondering if this is the source of all my problems? Maybe the guy who did the work for the previous owner changed the throttle, saw it didn't solve the problem and then just disconnected the water thermosensor to get it working?