I recently had this same problem on my '02 A4 1.8T, on the way home from work. The car went into a limp-home mode which limited the amount of throttle opening, revved very slowly up to about 5K and would not upshift past 2nd gear unless I manually shifted up. Speed was limited to about 40 mph, and acceleration was very slow. Several warning lights came on at once, including check engine, EPC (what does this mean??), and the ESP warning light.
I drove the car back to my office and took a company pool car home that night. The next day when I took it to my local dealer, the problem had gone away. They were able to retrieve the error codes, which indicated some error in the accelerator pedal sensor. They did not replace the part, only cleared out the codes.
The problem recurred about a week later. In this case, the EPC and ESP warning lights came on, but not check engine. I stopped the car, turned it off for about 1 minute, then re-started and the problem went away. So far, I have not returned it to the dealer again.
Not sure what the root cause is - loose wire, poor connection somewhere in the harness, or bad pedal sensor?? In both cases, it was raining outside, so I'm a bit curious if water is getting into some electrical connector somewhere and causing a short. This car has a throttle-by-wire system, which has several different safety back-up strategies in case of a fault anywhere in the system. But it's very annoying if some simple harness issue is causing it, and especially since the dealer seems willing to simply clear the codes without doing a deeper investigation into the root cause. It's no longer "safe" if you are expecting to be able to accelerate out of a situation, and there is no power to do it.