Adam Le Fondre's penalty on 65 minutes sealed their win after both teams finished with players sent off and the visitors squandered a first half spot kick of their own.
In a bad tempered affair the Millers shaded the opening exchanges which saw Paul Rodgers booked for the visitors after a late tackle on the recalled Gavin Gunning.
Josh Walker and Danny Harrison both had efforts saved by Jason Steele as Rotherham pressed for the opening goal, but it was keeper Andy Warrington who they had to thank just before the break.
Luke Guttridge was tripped in the area by Pablo Mills but Warrington made a fine stop from Ryan Gilligan's spot kick.
Northampton started the brighter after the break and John Johnson tested Warrington with two efforts, the second after a jinking run that the home stopper did well to push wide after 55 minutes.
The games first red card came on 63 minutes as David Hinton brought down Le Fondre in the area after Marcus Marshall had put him in the clear. The Millers top scorer made no mistake with his 28th of the season to open the scoring.
Marshall then missed a golden chance to make the game safe, after linking up with Le Fondre he was denied by Steele when he seemed a certain scorer before a nasty ending to events.
15 minutes from time Harrison was dismissed for a two footed tackle on Guttridge, who was also given his marching orders for his reaction during the resulting brawl involving several players.
Sub Abdulai Bell-Baggie almost caught out the 9 men near the end, but his solo run saw him run out of steam and Steele gathered as the Millers held out to stop a slide of four successive defeats.