The youngster displayed some outstanding form in a hard-fought local derby and inspired Birmingham to bounce back after going behind to a 21st-minute Benick Afobe goal - his 30th strike of the season.
Blues equalised in the 25th minute through Rob Kiernan, who recorded his first goal since his arrival on loan from Wigan in January.
But it was Gray who produced the highlight of the game with his 61st minute winner when he raced fully 80 yards before slotting the ball home.
It was a fine win for Blues, who increased their unbeaten home run to six games as they inflicted Wolves' first defeat in seven outings and dented the promotion aspirations of the Molineux men.
Wolves newly-found confidence was emphasised in their early play when they produced some positive attacking moves in which Bakary Sako was usually involved.
However, as the game settled down Blues began to put pressure on the promotion hopefuls although their only shot in the opening 20 minutes was a weak effort from Diego Fabbrini on his first start.
Gray then cut loose and fired in a rocket shot which was effectively saved by Carl Ikeme.
But in the 21st minute Blues' stumbling defence was penetrated when Sako slipped a tackle by Jonathan Grounds to provide a low cross into the middle where the unmarked Afobe was able to coolly slot home the opening goal.
If Wolves thought they would be able to dictate the game after this goal they were quickly mistaken, as Blues were back on level terms in the 25th minute.
A David Cotterill corner was caught on the half volley by Grounds. The ball appeared to have gone over the line but it was only scrambled away a few yards to Kiernan, who made no mistake from close range.
The goal undoubtedly boosted Blues and they played with more penetration, with Gray showing better form after moving from the left to the right flank.
Wolves' response came from two long-range efforts on target from Sako and Kevin McDonald but both were well saved Darren Randolph.
However, it was Gray who produced the highlight of the game in the 61st minute with an individual piece of brilliance which has marked him as one for the future.
The youngster gained possession following a corner deep inside his own half before setting off on a tantalising run. He was challenged by Scott Golbourne, who at one stage robbed Gray only for the talented Blues player to regain possession.
Showing a good turn of pace he then raced towards the Wolves goal before completing his solo effort with a raking drive past the helpless Ikeme.