If this were a 3.8 I'd say pull the crank sensor and at the least clean or replace it while you are checking wiring to ensure nothing got nicked etc.

The crank sensor on a 3.8 is magnetic and over time can pick stuff up that will cause it to be pissy. Heck.. my Audi recently tossed a cam sensor code (there's 4 fwiw) and sure enough there was the typical layer of stuff on the magnetic sensor.