While the phrase “Oh, my God” could be a prayer, it is not usually meant in this way. More commonly it uses the Divine name as a mere expression of surprise or exasperation. This is not a reverent or prayerful use of God’s name in most circumstances. The word “vain” means empty. And, therefore, the context you cite would usually seem to qualify as using God’s name in vain.
However, in assigning culpability (blameworthiness), it is good to remember that some have developed a bad habit of using this expression. As such, they usually commit the sin in weakness rather than malice, not intending to show disrespect to God.
It should further be recalled that the Second Commandment, “You shall not use the name of the Lord in vain,” has for its first meaning that we should never use God’s name to swear falsely or curse others. Irreverence of God’s name through casual use, such as you cite, is an extended meaning of the commandment. Thus we see that violations of the Second Commandment do admit to some degree of seriousness. It is far more serious a sin to use God’s name to swear falsely than to inadvertently use it to express surprise.
Still, one ought to avoid such vain or empty uses. One way to help break a bad habit that may have developed is for the one who says, “Oh, my God!” to correct themselves aloud by saying, “Oh, I mean to say, ‘May the name of the Lord be praised!’” This makes reparation and also helps break the habit.