that's what I was thinking too.
As it seemed to work for a bit, it's probably confusing the ECU so ECU gives a certain fueling program.
Then, when it starts to fail, ECU responds to the now new temp parameters(which aren't real), probably causing the surging that the OP describes.
Then again, once ECU realises that the ECT sensor is dead, uses the fuel temp as a parameter instead .. so as OP said, drives normal.

