Wow - that’s a pretty serious diagnosis to jump to. Did the mechanics say why they think the engine is shot? Did they do a compression test and find a warped head or something? This goes to ftillier’s comment - prior overheating can warp the heads pretty quickly. I’ve never heard of someone scrapping an engine just because they can’t figure out a misfire situation.
Regarding your question about the ECU, I suppose it’s possible that something is going wrong in that department but it would not be my first guess. I would sooner suspect some other electrical problem, like a bad coil harness or something like that, before I would suspect the ECU itself.
Assuming the mechanics don’t have some good reason to call it quits here, I would try to replace that last sensor and try to confirm a good and proper connection on all the o2 sensors to see if that clears up the fuel trims at all. You might have more than one thing going on and it would be good to rule out the o2 sensors if possible.
Aside from that and the things you’ve already done, look at the plugs to see if there is any fouling, check for manifold leaks, do a compression test, maybe a backpressure test on the exhaust to make sure the cats are okay. I might revisit the timing issue as well - you mentioned in a prior thread that one of the cam sprockets and a VVT unit was replaced. Wondering what the problem was there and whether it has returned, i.e., maybe the problem was not the VVT but the wiring.
Seems like there is a lot that can be investigated before resorting to a new engine, but I know its not cheap when you are relying on mechanics (not sure what rates are like in Kuwait).