Many cars do this surging thing. All the early EFI cars such as these MBs and all BMWs will do it. The 3.5 is just more susceptible. The car has to be perfect or the fast idle gets to the cut-off point. The reason it stops when you put it in gear is the idle speed drops below the threshold.
All you have to do to stop it is adjust the idle cold till it doesn't do it. Then when warm it must still idle high enough.
Bosch Master, ASE Master, L1
33 years MB technician