I have something like this going on, about once or twice a month. Here's my thread on the topic:
It happened today, sent me back searching. When it occurs, it makes the sound when I let off the gas or idling. Goes away when I step on the gas. If I shut the car off and restart it, it usually goes away, first try.
So far only one code thrown, but I'm not positive it's related to it. On one occurrence got code P0012.