McNamara was told his time at Tannadice was up in the immediate aftermath of their latest Ladbrokes Premiership defeat.
United looked to be heading for a much-needed win when Billy Mckay opened the scoring from the spot in the 24th minute.
Saints goalkeeper Alan Mannus was sent off for bringing down Mckay after the striker latched on to a short backpass from Tam Scobbie and home boss Tommy Wright also lost the in-form Michael O’Halloran to injury.
But Graham Cummins headed an equaliser following a corner just after the hour mark and then headed on for Simon Lappin to loft a winner ten minutes from time.
United did not confirm McNamara’s departure but it is understood chairman Stephen Thompson delivered the news at McDiarmid Park ahead of the legal process of his contract termination.
The former Celtic and Scotland player has led United to three top-six finishes and two cup finals but has paid the price for a poor run of form this year.
United have won four out of 24 league games since selling Stuart Armstrong and Gary Mackay-Steven to Celtic in February. McNamara also lost Nadir Ciftci to the champions in July but the United board feel they have given the former Partick Thistle boss ample funds to rebuild his squad and expected a better start to the season from a club with a top-six playing squad budget.
United sit second bottom with five points from nine games with their sole league win coming against Motherwell on 8 August. The United fans vented their frustration with McNamara after the game, which saw United fail to build on their lead and man advantage.
Afterwards Cummins claimed he always thought Saints would get back into the match. The Irish striker said: “I think we deserved to win, first and foremost. You’ve got to credit the gaffer because, when we went down to ten men, a lot of teams would have gone to 4-4-1, but we went 4-3-2 and with ten men we were actually the better side.
“I think we always felt the equaliser was coming and it wasn’t like we were just sitting back. We kept the ball well and had good movement. Normally when you go down to ten men you can be negative and hopefully catch them on the counter-attack or something like that. We were just positive and I always felt we were the better side in the game and that we would come away from the game with something.
“At 1-1 they maybe controlled the game a bit and I thought ‘we could just get away with a draw here or something’. But Simon came on and it was an excellent finish from him as well – I don’t know how he’s actually got it right into that corner, up and down from there.”
St Johnstone boss Wright hailed his team’s win as one of their best in his time at McDiarmid Park.
Wright, who took off a midfielder rather than a striker to get substitute goalkeeper Zander Clark on the pitch, said: “I told the boys in the dressing room that I’ve been here for four years in November, as assistant manager and manager, and I rate that right up there as one of the best performances they’ve given me. I’m absolutely delighted with it and it was fully deserved.
“I thought it was important to keep two men up front. It’s hard work for the three in midfield then but it was important to not let them get a foothold in the game.”
The Saints boss said he could contest the Mannus red card. He added: “The ball’s going to the left and away from goal slightly, even though it is an open goal, and Dave Mackay’s in a reasonably good position. I thought penalty and yellow card. If I see anything on the video then we’ll appeal it.”