The Tayside club won in the end thanks to Nadir Ciftci's injury-time winner which rounded off a sterling comeback made possible by earlier goals from Brian Graham and Stuart Armstrong.
St Mirren had raced into a first-half lead through goals from Paul McGowan and Steven Thompson but United fought back, with the aid of a hotly-contested first goal from Graham which appeared to be offside.
McNamara conceded his side carried their fare share of luck on the day.
He said: "I thought we were fortunate to win today.
"We got a break at our first goal. It looked offside although I would need to see it again but the lads showed great character to get it back to 2-2 and then pushed on for a winner.
"There was a lot of character from the team. I was kind of planning to make a few changes on the hour mark.
"Young Ryan Dow did really well when he came on when the game was a bit stretched and that helped."
McNamara praised Saints for their display but still saluted his own players for refusing to give in when they head might have gone down.
McNamara said: "I thought St Mirren deserved a lot of credit for the way they played.
"They were excellent in the first-half. Take nothing away from them in that respect. I knew they wouldn't be able to sustain it for the full 90 minutes.
"It was a great response from us. I'm delighted about that and to get back to winning ways. It's still a great three points for us under the circumstances."
- Sports & Recreation
- Brian Graham
- Nadir Ciftci
- St Mirren
- Steven Thompson