Quick check for speedo gear in tranny. Get the car up in the air, disconnect the speedo cable at the tranny, push a q-tip into the square hole that the end of the cable goes into. start the engine, select Drive and then get under the car to see if the q-tip is spinning. If it is, grab the end of the q-tip and see if the gear still wants to turn. If the gear continues to turn, it's your cable. If not, then it's either the pinion gear on the speedo cable fitting in the tranny (can be removed) or the worm gear on the tailshaft (not likely suspect, rare failure item) Of course, be sure that all safety considerations are observed with the vehicle on a lift. I believe that if the gear is broken, the tailshaft can be removed w/o dropping the whole tranny, but, I am not sure. Maybe Benzmac has that answer.. Good luck..
1987 BMW 325