Apart from the goal, neither side created too much in the way of chances in the first half.
But Northampton got back on level terms in the 66th minute when Steve Guinan headed home Gilligan's free-kick.
Two minutes later Courtney Herbert should have put Northampton ahead after racing clear but he shot wide.
In a pulsating finish Bournemouth had a chance to win from the penalty spot in the 88th minute following a handball by McCready but Dunn saved Lee Bradbury's penalty.
And two minutes into stoppage time Herbert won a penalty for Northampton and Gilligan converted the ensuring spot-kick to book his side's place in the next round of the Johnstone's Paint Trophy.