United were cruising to victory thanks to first-half goals from Damian Casalinuovo and Craig Conway before Gomis was sent off, apparently for lashing out at Stephen McGinn.
Saints immediately pulled a goal back when Chris Innes' header seemed to deflect in off Darren Dods.
Jennison Myrie-Williams looked to have made the game safe late on but substitute Stephen O'Donnell set up a grandstand finish in a bad-tempered clash at Tannadice.
As well as Gomis' red - United's third in a week - there were six yellow cards shown by referee Brian Winter, who might even have dealt out more punishment.
United, who beat Celtic for the first time in a decade in their last home game, made a sloppy start, repeatedly giving the ball away in their own half to opponents who were looking lively.
And, after both sides exchanged harmless long-range efforts, Hugh Murray volleyed over a waist-high Jack Ross cross 10 minutes in.
The visitors were then on the wrong end of two marginal offside decisions inside two minutes.
The first did not matter as Billy Mehmet shanked his finish but the second saw recalled strike partner Michael Higdon net from Garry Brady's poke through.
The atmosphere on and off the field was tame but, when McGinn took out Gomis in mid-air 21 minutes in, both sets of players had to be separated.
McGinn was booked, while Mehmet and Andy Webster received a lecture from Winter.
Higdon then missed the best chance so far when he turned Murray's cross wide from close range before the bad blood continued when Brady and Myrie-Williams went to ground in the box at either end.
Winter waved away both incidents but there was definitely an edge to a game that nevertheless needed a goal.
It arrived in the 29th minute when a perfectly-weighted through ball from Sean Dillon, playing as a makeshift midfielder, allowed Casalinuovo to turn in the box, shrug off Innes and sidefoot home his seventh of the season.
Saints had every right to feel hard done by but they should have been 2-0 down seven minutes later when David Goodwillie made a hash of his finish from six yards.
But, two minutes before the break, Paul Gallacher was left red faced when Conway curled in a free-kick after the Saints goalkeeper left a huge gap at his near post to gift the midfielder a first goal since April.
With seconds of the half remaining, Mehmet hit the upright at the other end, the ball rebounding too quickly for Higdon to react.
United went close to a third after the restart when a quickly-taken free-kick saw Paul Dixon cross for Casalinuovo, who side-footed wide from six yards.
Myrie-Williams was booked after being adjudged to have led with the elbow on Stephen Thomson 20 yards out.
Ross' resultant free-kick hit the wall in a half that exploded into life a minute before the hour mark when Gomis was shown a straight red card.
St Mirren took immediate advantage, Ross' free-kick headed goalwards by Innes before taking a crucial touch off Dods.
United boss Craig Levein immediately sacrificed Goodwillie for Scott Robertson, who was a surprise inclusion on the bench after two months out with a groin problem.
Both sides soon made another change, Stephen O'Donnell coming on for Brady and Jon Daly replacing Casalinuovo.
With less than 15 minutes remaining, Saints threw on the fit-again Stephen Robb for Murray, before David Barron became the latest player carded for a high challenge on Myrie-Williams.
For the second week in a row, United scored with a man disadvantage when Conway found Myrie-Williams in the box and the winger clipped a delightful left-foot finish over Gallacher for his first United goal.
The game looked over with 11 minutes left but Saints still brought on Conor Ramsey for Thomson moments after Innes was booked for a poor tackle.
O'Donnell set up a grandstand finish when his left-foot shot deflected past Nicky Weaver with four minutes left.
Dods was off the field receiving treatment at the time and was eventually replaced by Garry Kenneth.
O'Donnell became the latest player to see yellow after leaving Dixon in a heap as United held on.