Luke Chambers could hardly have chosen a better moment to finally open his goalscoring account for the Cobblers as his stunning second-half strike gave John Gorman's men a first home win of the season at the eighth time of asking.
The patience of Gorman and Northampton fans had been tested to the limit with plenty of good football going unrewarded by precious home points despite a remarkable unbeaten sequence on the road.
But all that was forgotten when Chambers, making his 133rd appearance for the club, connected sweetly to a long flat throw-in by David Hunt in the 55th minute to bury an unstoppable shot past Swans goalkeeper Willy Gueret.
Both Gueret and his opposite number Mark Bunn made some excellent saves during the match, while in stoppage-time a flare-up resulted in referee Phil Crossley sending off Swans midfielder Leon Britton for a second bookable offence.
He also brandished yellow cards to home players Chambers and Jason Crowe, which took the total of yellows in the match to eight.
Early drama saw a volley by home skipper Scott McGleish brilliantly saved by Gueret before Bunn made a terrific double save in the 11th minute.
He firstly performed wonders to tip a volley from Rory Fallon over the crossbar and, almost in the next breath, a shot by Andy Robinson into the ground bounced up and was tipped against the crossbar by the athletic Bunn.
Swansea created few chances after that while, at the other end, McGleish almost opened the scoring when he narrowly failed to convert a chip forward by Crowe.
Bunn was again performing heroics early after the restart when he made a flying save from Lee Trundle but then came Chambers' opener to really set the match ablaze.
Northampton almost doubled their tally when James Quinn saw his shot well saved, while at the other end Robinson fired a free-kick over the bar.
Swansea's best chance of an equaliser came with six minutes left when Britton raced into the box only to see his shot pushed away by the excellent Bunn.