When it happens, do the fuel computer readings (such as Instantaneous Consumption) go to pot? If so, suspect the ABS ECU.
Yep, as mentioned, Check all other speed functions.
I had the same one day as the speedo just stopped working completely (everything else on instrument cluster was OK and no warning lights.
ABS and Traction control ALL WORKED fine, but Cruise Control didn't work not work as all gets signal from ABS ECU (Pin 9) - BLRT colour wire(Blue with Red Tracer). I changed ABS ECU and normal service was restored
(after filling the swear box from the job of changing the ECU as the 6 torx screws are a TW#& to get to
but doable.
Check, as mentioned, if instrument cluster seated OK. If cluster out is, then check continuity from ECU Pin 9 to Immobiliser, then other side of immobiliser to connector in passenger foot-well (Its from the footwell that it then goes to all the other functions (Cruise, Instrument, Climate control, Radio, sunroof etc). If continuity OK, then its ABS ECU.
Pin 9 of ABS Ecu goes via a connector in engine bay by battery. Its (RH I think) of the two small black torpedo shaped connected (small rubber boot on the top - couple inches diameter - Plug has a locking ring halfway on it from memory which will need to undo to access connections inside.
Good luck, and let us know how get on.
Andy.