Most likely would be the speed sensor in the gearbox, or the connection to it, or just possibly the speedo gauge unit connections. Not very scientific....but have you tried whacking the top of the instrument binnacle? IIRC, the gauges are bolted into the dash PCB and they can come loose causing connection faults.
Other option would just be the dash PCB itself of course.
Yeah, Chris has it covered. The signal generator that plugs into the top of the gearbox is pretty famous for being a bit "fickle". Whacking the instrument binnacle works for me, but my problem is slightly diferent. Occasionally (when it's feeling evil), it will just show a speed 10-15 MPH slower than what it's actually doing. This will either have the effect of losing me my licence or killing me! In fact, the first time it did this particular little party piece was on a fast twisty "A" road that I know very well. The car felt awful, really unstable, at the speed I was doing - so much so, that I spent quite a while checking tyres, suspension bushes and settings! It was only some weeks later that I realised I was doing it 10 MPH faster than the speedo was showing! Anyway, no that I'm wise to it, a thwack on the binnacle usually restores accuracy, so I assume there's a poor connection in there somewhere.
It's a cross between a thump and a whack! I think you're wise to pursue the gearbox end first. They are troublesome (I'm on my last one at present)! Taking the binnacle out is relatively quick and easy. The next thing to try might be to simply unplug all the connectors on the back of it (there are plenty!) and give them a squirt of switch cleaner, then re-connect. You can't really mix them up, so it's relatively straightforward. If that doesn't work, I'm then a bit out of my depth!
Once or twice the speedo on my 166 has played up - it starts off showing about 20mph while stationary then adds the actual roadspeed on top. Says I'm doing 50 when doing 30. Still disconcerting though.