No you can't. Not unless the melee is incompetent. When I am on my melee and I attack a Merc/Commando, they always die. Always. Well OK, that is a slight exaggeration. But excepting for the sort of cases where the melee is at half health and Merc/Commando is at full health, or the melee has all his abilities on CD, etc. the Merc/Commando should never beat the melee.
Now I am not a big fan of the "Run & Gun" suggestion since it helps the Merc Pyro not at all. But I was rather taken aback by your claim that the Merc could use that ability to heal 3 times in a row as a trump card. I mean seriously? Who cares if a Merc dps casts 3 heals? You don't think the damage output of a Carnage Mara or Rage Smash Monkey in 9 seconds is well over the healing from 3 Rapid Scans? A reasonable melee dps is more than capable of killing a Merc healer. He's going to make mincemeat out of a Merc dps who tries to be an ersatz healer.
If its so far apart that you can't win by recovering 30%+ of your health (50+ with medpack), then you're awful. I get the "I always kill mercs" argument, because I experience the same thing. That being said, 1vs1 on my merc I also always win. That's because the vast majority of people are really bad at PVP and/or gearing.