Getting the engine back to proper running condition is a process of checking all components to ensure they are working and up to spec. These engines connectors, the ones with the spring clip, are notorious for not being very weather resistant. Consequently moisture gets in and corrodes the connection. This leads to components working intermittently or failing altogether.
Step one is to pull the connectors and see if they are clean. These are the ones for the injectors, CAS, PTU, AAC, FICD, Air Regulator, MAF, TPS, Coolant Temp Sensor, as well as the EGR solenoid. IF there is any green corrosion on them it needs to be thoroughly cleaned. It's best to first scrape away any buildup, then apply a good quality contact cleaner ( my favorite
http://www.mgchemicals.com/products/801b.html) and then also apply some dielectric grease to protect them.
Step 2 is to test all the components while the connectors are off. The measurements can be found in the manual
http://www.300zx-twinturbo.com/cgi-bin/manual.cgi in the EF&EC section starting on page 178.
Make sure the timing is set to 15 degrees as well.
Also it's advisable to pull your spark plugs. Make sure they are the NGK ones that came with the car, not some after market plug. These engines are fussy. There are a couple others that will work, but in 99% of the applications the factory plug is the best. While the plugs are out, perform a compression test.
Your erratic idle could be several things such as intermittent spark caused by corrosion on the (CAS/PTU) connectors, poor coil pack (which is rare), AAC not working (common) or/and perhaps a vacuum leak.
The fuel pump pressure is also something that is good to test, not necessarily emissions related but should be done.
If all connectors are checked, components tested etc you will find the problem.