Northampton took a 15th-minute lead when Foxes defender Kerrea Gilbert saw the ball ricochet into the back of his own net after skipper Matt Oakley had seemingly cleared off the line from Leon Constantine - Jason Crowe had seen his header hacked away seconds earlier.
But Town's lead lasted just five minutes after Mark Hughes was harshly adjudged to have impeded Matty Fryatt on the edge of the box and ex-Cobbler Steve Howard converted the spot-kick.
Fryatt went close just before the break when Dunn spilled a cross, but the Northampton keeper redeemed himself in the second half to twice deny Leicester's top scorer. His first was a fingertip save and the second a reflex stop after Crowe had misjudged a backpass.
Leicester pressure finally told and they grabbed the winner after 73 minutes, Tom Cleverley racing down the right and crossing for Dyer to apply a neat finish from 10 yards.