Found this on another site, not my thread but it is for a G35:
I realize this is an old thread but I read several threads about this and I can't tell if the issue is resolved. This happened to me this weekend. I was replacing my spark plugs at 100,000 miles and noticed the throttle body was dirty, it has never been cleaned. I did not know the issue with the TB so I just cleaned it without disconnecting the battery or unplugging the TB. Of course this led to the high idle and the SES light and P0507 code, I have a code reader. After reading several threads on this site I decided to try the reset. The instructions on here are a little confusing and I could not get it to work. However I found a youtube video of it and it worked and the cars runs as good as ever. I did the following:
1. Warmed the car up by driving to work, about 30 minutes.
2. Parked making sure the front wheels are straight ahead and everything is off, I.e. Radio, lights, wipers, heater, etc. as instructed by the youtube video. This seems to matter because the reset did not work before I did this.
3. Shut the engine off, waited 10 secs.
4. Turn the key to on, waited 3 secs
5. Turned the key to off, waited 10 secs
6. Turned the key to on, waited 3 secs
7. Turned the key to off, waited 10 secs
8. Turned the key to on, waited 3 secs
9. Turned the key to off, waited 10 secs
10. Turned key to on, waited 3 secs
11. Stomped on and released the accelerator pedal 5 times in 5 seconds, waited 7 to 8 secs
12. Depressed and held down the acc pedal for about 18 secs, the light started blinking around 10 secs and then stopped at around 18 secs, released the pedal as soon as it stopped blinking,
13. Started the engine, do not turn the key off first before starting the engine, as soon you release the pedal turn the key to the right to start the engine. I screwed this up a couple times.
That was it, now everything is fine. I deleted the SES code with my reader.