Saints could have been a goal and a man down at half-time, after Marko Stamenic's 20th-minute opener, and an altercation involving Flynn Downes.
Downes escaped with a yellow, and substitute Shea Charles, who replaced him at half-time, levelled for the visitors within 15 minutes of the restart.
And man of the moment Archer struck with one of his first touches in the 90th minute, to send a sold-out away end home with dreams of promotion.
The result meant Saints are unbeaten in 19 games with seven successive league wins, their longest winning run in the same season since 1908/09.
It pulled them within one point of Millwall in second-place with three games to play, and level on points with Ipswich Town - with five games - in third.
Tonda Eckert made six changes from the side that beat Blackburn Rovers in a rescheduled fixture on Tuesday, but very few of them, if any, were surprises.
Downes, Caspar Jander, Leo Scienza and Ross Stewart came back in, while Finn Azaz returned from injury and Nathan Wood replaced Jack Stephens.
Swansea's top scorer, Zan Vipotnik, led the line for the hosts, who had only been beaten at home by already promoted Coventry since Boxing Day.
And the striker played a key role in his side taking the lead after 20 minutes, heading a cross that went beyond the six-yard box back into danger.
It passed Daniel Peretz and Stewart before Stamenic met it and turned it into the empty net, opening the scoring for the third league game this season.
The occasion threatened to boil over when Downes could have seen red for an angry reaction to being confronted by Melker Widell for a hefty challenge.
He grabbed Widell's shirt and appeared to push him to the ground, but the referee only booked both players for their part in the altercation.
Tension built as Downes and Goncalo Franco entered an immediate war of words, before Josh Tymon flew into a late tackle on Downes minutes later.
Saints composed themselves in search of an equaliser, with a succession of crosses, James Bree seeing a shot saved, and Stewart firing over the bar.
But they trailed at the break, when Eckert saw fit to bring Charles on in place of Downes, whose yellow card status put him at serious risk of a sending off.
Saints went back on the hunt, with Charles pouncing on a spill from Swansea goalkeeper Lawrence Vigoroux - only to see his effort blocked.
Swansea blocked four more follow-up attempts before the danger dissipated, and saw appeals for a penalty against Wood waved away by Oliver Langford.
Saints pulled level in the 57th minute, with Scienza flicking on a short, in-swinging cross from Azaz for Charles to divert well into the bottom corner.
Substitute Gustavo Nunes could have restored the lead but for a last-ditch block from Wood later on in the tie, before Goncalo Franco dragged wide.
And it was another change that paid dividends in dramatic style, as Archer volleyed Jander's cross past Jay Fulton on the line to lead in the 90th minute.
Swansea: Vigoroux; Parker (Ward, 61), Cabango, Burgess, Tymon, Stamenic (Fulton, 73), Franco, Cullen (Nunes, 61), Widdel (Yalcouye, 61), Eom, Vipotnik (Idah, 67).
Unused subs: Fisher, Walta, Cooper, Ronald.
Booked: Franco, Widell.
Saints: Peretz; Bree (Archer, 87), Harwood-Bellis, Wood, Manning; Downes (Charles, h-t), Jander, Matsuki (Stephens, 90+1), Azaz, Scienza (Edozie, 90+1); Stewart (Larin, 67).
Unused subs: Long, Fellows, Welington, Bragg.
Booked: Azaz, Downes.