League Two strugglers Stanley held out until two second-half goals in the space of 85 seconds from Nicky Maynard and substitute Rudy Gestede sealed the 2012 finalists' place in round three.
Mackay was delighted to avoid an upset as his side earned a trip to West Ham in the next round.
He said: "That could have been a potential banana skin tonight if we hadn't gone out and been professional.
"We knew they were going to try and pack the area and make it difficult for us. We had to keep shifting the ball from side to side and eventually little gaps open up, which is what happened.
"As the second half wore on we were increasingly influential and looked as if we were going to score."
It needed a moment of brilliance from Maynard to break the deadlock as the former Bristol City striker flicked the ball over his head before coolly slotting home on the hour.
Gestede's first-time finish moments later was another indication of the Premier League outfit's class and, particularly with summer signing Andreas Cornelius coming off injured in the first half, the form of his strikers pleased Mackay.
The Bluebirds boss, who does not believe Cornelius' injury is too serious, added: "Nicky Maynard's first goal was fantastic. The second one as well; a great ball from Jordon Mutch and the finish from Rudy Gestede as well.
"I'm delighted for the boys tonight. They applied themselves really well and if they hadn't, that could have caused us a problem."
Accrington boss James Beattie wants his side to replicate their performance in the league as he attempts to steer Stanley off the foot of the fourth tier.
"The lads are disappointed in there," said the ex-Everton forward.
"There's no shame in that performance at all. I thought it was very good. All the units were working a lot better tonight, the shape was good, the discipline was good.
"They can hold their heads high, I've told them to walk out that dressing room with their chests out and their chins held high."
Beattie, who was handed his first job in management at the Crown Ground back in May, even went as far as claiming it was the best he had seen his side play.
"I would put it up there with the Middlesbrough performance (in the last round when Accrington won 2-1)," he added.
"Now we just need to replicate that Capital One Cup performance in the league and there'll be no problem whatsoever."