Bedene has been struggling for confidence amid the stress of his battle to compete for Britain in the Davis Cup.
The Slovenia-born player should learn in the next week or two whether there is any chance of another appeal and he revealed the uncertainty has taken such a toll on him that it has translated into physical pain.
However, he was happy with his form and that showed against Austrian qualifier Melzer, whose brother Jurgen beat Novak Djokovic here in 2010 on his way to the semi-finals.
Melzer possesses a heavier weight of shot than Bedene but the British player's consistency ultimately proved decisive.
Bedene, who is being coached on a temporary basis by GB Davis Cup captain Leon Smith, will play either 31st seed Federico Delbonis or Spain's Pablo Carreno Busta in the second round.
WATCH: How Great Britain's Aljaz Bedene won his first match at the French Open