Saints had gone into the match searching for a first home win since early May and shortly before the break went ahead through Kenny McLean.
But back came the Dark Blues with two goals during a 15-minute spell after the break to deny the hosts who remain second from bottom in the Scottish Premiership table.
To add to their woes, Yoann Arquin was sent off 11 minutes from time after collecting his second yellow card of the afternoon.
And it was Arquin who could have fired Saints ahead inside the opening five minutes, as St Mirren began the match strongly, with the striker twice forcing good saves out of visiting ‘keeper Scott Bain.
As Dundee slowly found their feet, James McPake had a header saved before McLean broke the deadlock five minutes before the break when he collected Stephen Mallan’s pass to fire home with a low strike from 20 yards.
However, the visitors came mighty close to equalising 60 seconds later when Mark Ridgers saved superbly from Gary Harkins.
McLean headed over early in the second half as St Mirren searched for a second.
But, just as caretaker-boss Gary Teale may have harboured thoughts of a first home triumph, the visitors levelled matters on 53 when Irvine latched on to Greg Stewart’s assist.
And Stewart was also the provider for Dundee’s winner when he fed Davidson whose deflected effort from 12 yards wrong-footed a helpless Ridgers.
The game continued to be an end-to-end affair over the remaining 22 minutes with Marc McAusland coming close to an equaliser as he headed wide from inside the six-yard box.
The win keeps Dundee safe in seventh spot while leaving Saints to consider another woeful result, having collected just two points from 13 home league matches this campaign.