I don't think its your gas cap, if I was in your shoes the first thing I would do is actually replace the gas cap itself, the seals could be causing it to leak.. its cheap too.. like $20-30.. I believe the problem lies in your air mass sensors.. looks like this..
http://www.saveonautoparts.com/catalog/european/airmass
I'm selling them 50% off dealer prices.. Just my way of giving back to the Mercedesshop members.. Why I say air mass sensor? because it is a common problem with the ML...
Steven