I just had a similar problem a few days ago (2001, 1.6lt (AEH), auto)
The speedometer stopped working all together and the fuel gauge wouldn't sustain around coners.
After suspecting this problem to be electrical (as the car had previously been completely under water and then recovered), it turns out the mechanical speedo drive gear for the speedometer vehicle speed sensor (VSS) had seized and broke internally.
I originally tested it by trying to turn the internal drive whilst still in the auto box. I couldn't spin the drive. This indicated that it was connected, or so i thought. After testing all electrical signals with a oscilloscope and finding no problems, i removed the mechanical speedo drive gear. Turns out i could spin the gear and the shaft inside wouldn't spin the sensor. it broke internally and the top part of it had seized inside.
I replaced the part and all returned to normal.
The instrument cluster needs a speed signal from the VSS which is greater then 0km/h in order to sustain the fuel gauge. If it reports a zero speed, then theoretically the car is not in motion therefore no need to sustain the fuel gauge.
When this happened, the engine sometimes would report a vehicle speed sensor code in the engine module. (didn't always register this). The signal for the engine module reads the VSS signal from the output (terminal 3, blue plug) on the back of the instrument cluster. Hence the code was registered in the engine module and not the instrument module. The instrument module thought the car wasn't moving and couldn't detect any faults. Its only when the engine module detected the car was in motion from the transmission speed sensor and then read a VSS value of zero that it would report the code.
Be sure to check the transmission speedo drive by removing it! This doesn't take long and could save you lots of time. Its located on the back of the auto box, above where the driveshafts connect. it has a VSS sensor on top of it that is normally covered with a heat shield.
Hope this helps someone.
Also, this mechanical drive may be broken internally but could catch somtimes causing intermitent faults.