Replacing the ECM is usually the last action in the diagnosis in anything the ECM controls when it comes to diagnosing through the factory books. Diagnosing the ECM is tough but is done by somewhat of a process of elimination. At first I had a slightly rough running car. I replaced the plugs, wires, caps and rotors with OEM parts. The car seemed to run slightly better but still somewhat rough and I just thought "Whatever..." Over a year later the car starts really running like crap and throwing a CEL for the engine coolant temp circuit malfunction. I replaced the engine coolant temp sensor for the ECM to really no avail, it still ran terrible. I have a Lexus tech buddy that works at a Toyota dealer and I was at whits end with the car. The next thing I thought was O2 sensors as they are original on 230k miles. We hooked the car up to a scanner and the O2 sensors appeared to either be going bad or the cats getting very very weak as the line should have been mostly flat and its was jumping a little at idle. Then he pointed to 2 mid 90's Lexus's sitting in the parking lot waiting on ECM's and we agreed that they seem to have issues with age and miles. We removed the glovebox and checked the reference voltage, which should be around 5V I think. It was over 8V.
The ECM measures temperature by resistance that comes from the temp sensor on the engine. To get a reading for the ECM it needs a reference voltage on each temp. circuit while the logarithm is calibrated for a certain reference voltage, usually around 5V. If the reference voltage is different from that then the ECM is either going to think the car is too hot or too cold. My ECM thought the car was too cold and that it was never warming up. The ECM keeps throwing fuel at it because it thinks it is cold but it never sees it warm up. This is why it only ran good cold and terrible hot.
I replaced the ECM and it runs better than it did with the original plugs and tune-up parts. I'm not saying this is your problem but you wouldn't believe the fuel mileage my car got with the bad ECM, if it would stay running...