I drive a 98 Legacy Outback. My car was having similar problems. Idling at a traffic light in drive the car would vibrate or rock pretty substantially. If I pressed the gas slightly, the vibration would lessen. Though this was pretty annoying, I didn't think too much of it. When my 'Check Engine' light came on, I took the car to the shop thinking it was an emissions sensor that would need to be fixed/replaced. They told me the Check Engine code indicated that I had a misfire in one of my cylinders. At first they suspected a burnt valve, but further investigation found that all I needed was a valve adjustment (with new shims or seats, I think that's what they were called). Apparently the valve wouldn't seat properly and this prevented the cylinder from achieving the necessary compression, and with the periodic misfire, I was more or less driving on 3 cylinders instead of 4. After having this fixed my car doesn't vibrate any more. The bill came to a little under $700 (at the Subaru dealer) which also included adjustments for the other valves while they had the engine apart.