Former Southport man Duffy latched on to a loose ball in the County box to score from close range after 72 minutes and maintain the Shrimps' play-off hopes.
McIlroy, whose side have now lost just one of their last 17 games, said: "It was a great win because it was a very tough game for us.
"The pitch made it hard to play our normal football and Notts County made it difficult for us as well.
"But once again we have plugged away right to the death and we have now picked up two scrappy 1-0 wins in a row which is what we needed.
"The lads have once again done the club proud and nobody can have asked any more from them over the past few months."