I had the exact same symptoms on my Nissan 180sx and I fixed it by replacing the plug on the wiring harness that connects to the throttle body position sensor.

I hope that helps.