The Dens Park outfit looked set for their 20th defeat of the campaign when Dougie Imrie, on his return to Danny Lennon’s starting 11, put the visitors ahead with a shot from close range before the break.
The Saints had a chance to increase their lead soon after, Lewis Guy cutting inside the box and delivering a powerful right-footed strike which was superbly denied by Rab Douglas at full stretch.
Douglas pulled off another outstanding save five minutes before the break when he reacted well to claw away a goal-bound header from Sam Parkin.
While the visitors dominated the first period, Brown’s men hit back after the break and equalised on 67 minutes as ex-Saints striker John Baird’s firm, low strike from 20 yards arrowed into the bottom corner.
The goal invigorated the home side and they deservedly went ahead 10 minutes later when Jim McAlister netted from close range after Nicky Riley had knocked down a cross from Gary Harkins.
The home side survived a few nervy moments to secure their first win since 17 November, and just their fourth league victory of the season, while putting a major dent in Saints’ hopes of a top-six finish.