After a goalless first half hosts Wimbledon thought they had the game sewn up as Sean Rigg and Jake Reeves netted within two minutes of each other for a comfortable lead on the hour mark.
But Northampton and Gray had other ideas, with the striker scoring in the 66th and 69th minute to earn his side a share of the points.
After an uneventful first half, the Dons came out brightly after the restart and Rigg found himself unmarked to nod his side ahead after 58 minutes.
And shortly afterwards Reeves smashed the ball into the bottom left-hand corner of the net from the edge of the box to double the home side’s lead.
Northampton got a lifeline when Ricky Holmes cut the ball in from the byline for Gray to power home from close range.
And before he knew it Gray was celebrating again as he headed in a Brendan Maloney free-kick.
The game continued to be lively but neither side could find a late winner.