if you have the ECU out remove both main covers and give the circuit board a good look for leaking capacitors. Caps will be cylindrical objects with a colored shrink wrap.. these can leak their guts onto the circuit board which will corrode it. Unlikely that this second ECU (IIRC?) has the exact same issue, but since you have it out it is easy to check.
The rest of what I'm thinking of needs to happen to the harness where it goes to the ECU.
There are 4 gray plugs that go into the ECU. The one notated as "D" on the EWD is called E7, and it is 22 pins. It is one of the two big connectors. The other large one is 26 pins, E10, for the record. If you look VERY closely there are tiny numbers printed on the back side of the connector where the wires go in. If you can't see these, Write out a list of the 4 corner wire colors and what pins they correspond to via the EWD (there is an index of each connector and which slots will have wires or an X to show no wire) to map out which pin is what.
If you look at your EWD You'll see the EFI main relay just to the left of the ECU, and a R-Y (Red/Yellow) wire going from the power source 15A EFI fuse to the EFI MAIN RELAY. It also jumps off of this and goes to page 4, where it drops down and into the ECU at E7 (22-pin connector) pin 2. Basically what this means is this wire/pin should see +12v constant via the EFI fuse.. even when the truck is off. This is what lets the ECU "remember" the idle and fuel trim settings, and also what gets voltage cut when you pull the battey or EFI fuse to reset the ECU.
Also on E7:
Pin 13 Black/Blue should see +12v when ignition is ON
Pin 11 Black/Red should see +12v when ignition is in START, ONLY when shifter is in Park OR neutral. Nothing in R,D,2,1
Pin 22 Black/White should see +12v when the ignition is in START, whether it is in Park/Neutral, or not
Personally I'd be checking pins 2 and 13 with the ECU out AND in.. and pins 11/22 with the ECU in only (to minimize cranking). You'll probably need help with the start circuits. You can push the multimeter probe into the back of the harness connector slots while they are plugged into the ECU.. just be careful not to damage anything by going bananas.
The start circuits may not be super relevant, but I know for a fact that on my toyota diesel swap with an electronically controlled denso fuel injection system, if the ECU didn't get a start signal, the timing would be WAY out. Clearly toyota/Denso thinks the start signal is important enough to run a wire and let it impact some parameters of how the ECU runs things.
On E10 (26-pin):
Pins 13 & 26 will be Brown, make sure these both have a very good ground.
Pin 24 is Brown/Black, also should get ground. Note that there is another Brown/black on this connector, but it is a ground from the ECU to a few sensors, it shouldn't show a clean ground unless the ECU is plugged in. (even then, it is unlikely to be your problem)
Hope this helps..
If it doesn't change anything, we can start moving on to oxygen sensors, IAC circuits, etc