Sounds like you might have a throttle position sensor problem too. But to answer your question, you can probably pull a wiring diagram online that will tell you which wire is which, or you can just start probing with your volt meter and you'll find them. You'll have a 12v power supply, a ground, a 5v signal return wire which goes back to the ECU. With the car on you should be able to read a voltage on the reference wire. Play with the throttle a little to see what the voltage does because it will vary with the amount of air flowing through it. If the voltage doesn't move or goes out of range you're gonna want to replace the sensor. If things appear to be within range check for a bad TPS.
Also, have you done any work under the hood lately? Possible vacuum leak from bumping the hoses.