Mr The...
Here is what I would do:
First of all, no need to replace " whole valve body". Yes, the 722.9 Transmission has lots of FLEA's.
Second, you could have a issue with a shift piston for 2nd to 3rd gear. I would inspect it, but before the inspection. Sign up for Mercedes EPC(You need a PC running Internet Explorer with Oracle Java fully updated...-You CANNOT circumvent this-It will not work on another browser, or operating system!!!!).EPC is free, but it will ask for a credit card...
EPC link:
EPC-net Online
Look up the parts to your ML500 per the VIN number, and see what parts are available for the valve body. I understand Mercedes Had lots of issues with the conductor plate, and shift solenoids. I do not have a diagram on 722.9, and it is different from 722.6. If the code points to the speed sensor, more than likely is. They tend to blister on 722.6. Inspect the filters on each of the solenoids, and blow them out. If you are the only owner since 2006 you are okay, but their has been a influx of cheap Chinese solenoids. The solenoids will have BOSH embossed on them. Inspect the o-rings on each of the solenoids.
The valve body is heavy, so use a jack. If the valve body has aluminum bolts, I believe you have to replace them. You'll need a torque wrench too.
Martin