So, I've got pretty much all the wiring sorted out on my Subaru 2.5RS ('98 chassis with a '99 engine/harness). I've even gotten all the check engine light issues resolved. However, I have one issue that keeps coming up. After an ecu reset everything works great. I'll take the car out driving and it's fine if I'm just Sunday driving or even driving moderately aggressively. But, if I really get into the throttle (WOT) and do a hard pull in 3rd, the engine cuts for a second right around 5,000 rpm and the check engine light comes on. After that, the idle won't drop back down - it stays at 2-3k rpm. The car stays like this even if I turn it on and off. I can get the idle to go back to normal by unplugging the IAC motor, but it goes right back to how it was after I plug it back in. If I resent the ecu, everything goes back to normal until I hit 5k rpm in a higher gear at WOT again.
Any ideas which sensor could be causing this?