Originally Posted by bordum128
Is it just the simple fact that the computer is all messed up when I disconnect the battery?
No. Your engine should still run well after the battery is disconnected.
In fact this could be a symptom of what the problem is. I don't know the degree to which the PCM can compensate for or disregard any given sensors input, but that learned response that is specific to your engines condition is getting lost when the PCM is powered off.
Point is, concentrate on the code. You don't wanna run your engine lean. I think that the weird thing
is a just a symptom.
Is that why you tried changing your thermostat? Engine getting hot? If so it only verifies the accuracy of the code.