Code 51 is indicative of either the A/C circuit being active or the IDL switch open while in diagnostic mode. The IDL switch is a switch inside the TPS which tells the ECU the throttle is open if the throttle is anything short of completely closed. Given everything you describe it sounds to me as though your throttle cable is sticking, throttle plate is sticking or the dashpot is sticking.
The power up diagnostic indicators should come on with the ignition in the "ON" position and remain on until the vehicle is started or the ignition turned off. They should all be off within about 5 seconds once the vehicle has been started.
NOTE: You CANNOT make any sensor or timing adjustments while you have a code 51.. Nor any other code for that matter, but people tend to think the code 51 is the exception.