The problem with the idle that you're encountering may be the TPS system or the IAA adjustment. The first thing to check is the TPS harness connector pins. The connector is located on the passenger's side of the motor just above the throttle assembly. Look at the pins and see if there's oxidation on them. If so, clean them with fine steel wool then lightly coat them with 'dielectric lubricant' which you can get at most auto parts stores.
For a procedure on adjusting the TPS, go the
http://www.240sx.org web site, FAQ section and look up 'Throttle Position Sensor DOHC'.
To adjust the IAA, Fully warm up the motor. Shut motor off. Disconnect the TPS harness connector. Start motor. Check the idle speed. It should read 650 RPM; If not, adjust the idle screw until you get 650 RPM. The idle screw is located on the passenger's side of the motor near the firewall below the intake manifold. Stop the motor. Reconnect the TPS harness connector. Start motor. The idle speed should now be 700 RPM.
As a side note, make sure the air filter is clean. If it's got 15,000 MI on it, replace it.