Top-scorer Cox added to Billy Paynter's earlier strike to seize all three points despite Northampton scoring a late equaliser through substitute Giles Coke.
With the Swindon faithful ready to turn on the already unpopular management, the home side began in unconvincing fashion as they looked scared and unwilling to support each other.
Northampton though rarely troubled goalkeeper Petr Brezovan until the 20th minute when referee Andy D'Urso changed the course of the match with a quick decision.
Ryan Gilligan was sent clear of the Swindon defence but, as he beat Brezovan to the ball in a 50/50 challenge, the Slovakian clipped his trailing leg.
D'Urso waved play on only for Gilligan to crumble to the ground but, instead of bringing play back to the original foul or even booking Brezovan, he let the game surprisingly carry on.
That incident woke Swindon and Michael Pook's strong challenge set up Anthony McNamee to tease Jason Crowe before striking the face of the crossbar.
Five minutes later, McNamee drifted onto the right wing and sent a side-footed shot for the far corner for Frank Fielding to adjust his body superbly and keep the ball out of harm's way.
Three minutes into the second half Swindon had the opener as Cox released Paynter down the right-hand side for the big frontman to out-muscle Chris Doig and drill his finish into the far corner.
Lee Peacock's spectacular chip ten minutes later clipped the woodwork as the Robins strived for a second and the prolific Cox duly obliged.
Pook's clever ball into the penalty area was headed back across goal by Sean Morrison and Cox was on hand to head home.
As the nerves set in, Northampton flung four up front but it took them three minutes into stoppage time to finally beat Brezovan as Liam Dolman's cross was converted by Coke.