I had this problem with an older Benz of mine. The speedometer would work for a bit, then just stop. I popped out the entire display (gas guage, speedometer, everything in one peice) and saw that there was a cable connected to the speedometer that was almost falling off. You could try to remove the display and see if something is loose, that is a first step. If that doesn't work, check out http://bimmer.roadfly.com/bmw/forums/z3/forum.php
for your Z3 message board. Not that this one is bad, it is just that there are tons of information posted on that site all the time and it is only about Z3s and M Roadsters/Coupes. You could ask them and I am positive someone will help you, probably within a few hours.