I have a 2004 Suburu Outback with a throttle positioning sensor (TPS) instead of a cable. Intermittently, I lose my throttle. At the same time my check engine light goes on and my cruise control button has a flashing light and my cruise control does not function… I coast off the road, place the transmission in park, turn “OFF” the engine, wait 15 seconds and restart the engine. The throttle control works and I go on my merry way. After a few hours of driving, the check engine light goes out and the cruise control functions again. This incident occurs about once a week. I have 145,000 on the engine.
More than likely it’s your pedal position sensor connector. I would spray both sides of the connector with contact cleaner and use a little diaelectric grease on it. Also, check and make sure it fully seats and locks when you put it back together. This is a known problem among Subaru owners. http://www.subaruoutback.org/forums/66-problems-maintenance/24906-code-p2138-throttle-position-sensor.html