The 10-man Dens outfit looked set for their 20th defeat of the Clydesdale Bank Premier League campaign after losing Declan Gallacher following his last-man tug on the scorer of Saint's opening goal, Steven MacLean.
But former Falkirk man Stewart popped up with a last-minute leveller to keep the basement club 15 points adrift of safety.
MacLean had headed the Perth side ahead 35 minutes in after home goalkeeper Rab Douglas sullied his 300th appearance for Dundee with a handling gaffe, but John Baird cancelled that out with his own header just before the break.
Saints struck again through skipper Dave Mackay's free-kick on 68 minutes as he made sure it was a double punishment for the hosts following Gallacher's dismissal.
However, just as the visitors thought they had done enough for the Tayside derby win, Stewart struck at the death.
It was rich reward for Brown following his controversial appointment as caretaker boss, a move that has not gone down well with the Dark Blues' support.