http://www.bbc.co.uk/sport/0/football/19159869
Nicholls's winner came three minutes after the interval when his header beat Joe Lewis following a corner.
Heidar Helguson had given Cardiff the lead with a penalty after three minutes when he was fouled by Kelvin Langmead.
David Artell's header brought Northampton level on 37 minutes before Nicholls's winner.
With eight players away on international duty, Cardiff started with five teenagers as well as summer signings Helguson and Joe Lewis.
And within two minutes Cardiff were awarded a penalty when Helguson fell under the clumsy challenge of captain Langmead.
Helguson took the kick and sent 17-year-old goalkeeper Dean Snedker the wrong way to give Cardiff an early lead.
Northampton won the only previous League Cup tie between the sides in the first round 16 years ago, courtesy of a 2-1 aggregate score.
The League Two side responded swiftly to going a goal down and within a minute Artell sent a powerful header wide from Chris Hackett's corner
Luke Guttridge also fired over from long range for Aidy Boothroyd's side while Cardiff's Joe Mason fired straight at Snedker
Stephen McPhail's involvement in the game came to an end on 18 minutes when he was replaced by youngster Tommy O'Sullivan.
Northampton deservedly drew level eight minutes before the break when Artell's header from Ben Tozer's long throw trickled past Lewis.
Ben Harding missed a great chance to put Northampton in front three minutes later but he could only shoot wide.
But the home side took the lead three minutes after the interval.
Lewis, making his Cardiff debut, failed to deal with an inswinging corner from Hardin and Nicholls nipped in to head home at the far post.
Cardiff at the time of the goal were down to ten men as substitute Jordan Mutch, who replaced Joe Mason at the start of the second half, was in the dressing room.
Mutch had white ankle tape on and new rules insist any tape worn has to be the same colour as the socks, in Cardiff's case blue.
Langmead came close to increasing Northampton's lead five minutes later when he turned well in the box but Lewis blocked his close-range effort.
Malky Mackay's Championship side offered little in response apart from a Joe Ralls long-range effort which flew over.
Nicholls nearly scored his second and Northampton's third with seven minutes remaining when his neat flick went just wide following Henoc Mukendi cross.
Substitute O'Sullivan wasted a glorious opportunity to level for Cardiff in the final minute but Northampton survived to book their place in round two.