Jo Kuffour's 71st-minute volley sent the Cobblers to another defeat - extending the winless run to four - as Bristol Rovers claimed a 1-0 win.
Kuffour's deflected shot decided the outcome after Northampton goalkeeper Chris Dunn had spilled David Pipe's right-wing cross when under pressure from Rickie Lambert and Jeff Hughes. Dunn claimed he was impeded and it must have been a marginal decision for referee Steve Cook.
Town contributed much to a closely-fought game, and manager Gray said: "I've never believed the old saying that you don't get any luck when you're at the wrong end of the table, but now I'm beginning to wonder.
"The players worked their socks off and deserved some reward. I thought there was a foul on our goalkeeper in the build-up to the winning goal, so the breaks did go against us. We did miss a couple of great headed chances, which was strange because you won't find two better headers of the ball than Scott Vernon and Adebayo Akinfenwa.
"The positive thing is that we have 18 points still to play for and four of our last six games are at home, starting with the next one against Southend. We have to make that count."