Last season's runners-up fell at the first hurdle this time and can have no complaints after the League Two side overcame the early setback of going behind to the Championship outfit.
It took just four minutes for new signing Heidar Helguson to get off the mark on his Cardiff debut.
The former QPR striker sent keeper Dean Snedker the wrong way from the penalty spot after defender Kelvin Langmead had been harshly penalised for impeding Helguson.
Cobblers responded well with David Artell heading just wide from Chris Hackett's corner and Luke Guttridge firing over from long range.
In between, Joe Mason fired straight at Snedker following a neat turn on the edge of the box.
Northampton finally got back on level terms in the 37th minute when Ben Tozer's long throw-in found Artell whose header beat the diving Joe Lewis and nestled in the bottom corner of the net.
Ben Harding missed a great chance to put the Cobblers in front three minutes later but he could only shoot wide after seizing on a weak punch from Lewis following another testing Tozer throw-in.
But the home side took the lead three minutes after the restart when Lewis failed to deal with an inswinging corner from Harding and Nicholls nipped in to head home at the far post.
Langmead almost increased Northampton's lead five minutes later when he turned well in the box but Lewis did well to block his close-range effort.
Guttridge was denied on the hour when his low drive was blocked by Ben Nugent with Lewis well beaten.
Cardiff offered little in the final third apart from a Joe Ralls long-range effort which flew over.
Nicholls went close to a second goal in the 83rd minute, his neat flick going just wide from a Henoc Mukendi cross.