I had it happen to me once... I was pulling a hay wagon out of a field and some of the tall grass got a hold of something. I had no speedo and it shifted like crap for about a 1/2 mile till I could get to a place and stop. I did when a car went out in front of me and I stopped, when I restarted, the speedo and shifting was fine.
I crawled underneath and there was some grass stuck to some things under there, but nothing major. Didn't see anything, couldn't find anything that seemed loose, so I've been driving it the last year and a half with no problems.
Do the obvious, wiggle all the wires on the sensors on the tranny once, and see if it improves.
Does your odometer still work? If that does and the gauge doesn't, then you might have a dead speedo, with everything else being good.