The summer signing from Leicester made the most of a rare chance in the starting line-up with the winner nine minutes from time.
It brought to an end Pompey's mini-revival under their new manager Michael Appleton - they were unbeaten in their previous four matches.
They looked a good bet to make it five as a game of few chances was meandering towards a goalless draw, but N'Guessan had other ideas with a neat close-range finish.
Despite their perilous position just above the drop zone, Millwall looked comfortable in possession in the opening stages but they only had an ambitious long-range effort from N'Guessan, which flew wide, to show for it.
Portsmouth's first opportunity arrived in the 17th minute when Dave Kitson headed Liam Lawrence's corner over the top.
Plenty of endeavour followed, but with little quality on show neither side looked likely to make the breakthrough until the end of the first half.
Then, two minutes before the break, Lawrence should have done better when he met a cross from Erik Huseklepp, but the unmarked Pompey skipper made a mess of his header which drifted harmlessly for a goal-kick.
And in first-half stoppage time Liam Feeney drove in a fierce shot which Portsmouth goalkeeper Stephen Henderson could only parry but Liam Trotter could not convert the follow-up.
Lions boss Kenny Jackett, who had already had to replace defender Nathan Baker due to a knee injury, made another change at the interval with John Marquis replacing top-scorer Darius Henderson in attack.
Moments later Pompey were forced into a reshuffle when Joel Ward limped off, with Aaron Mokoena entering the fray.
Portsmouth midfielder David Norris then had a shot blocked by Jimmy Abdou and Greg Halford wasted a potential counter-attack for the visitors with a poor cross.
At the other end Brian Howard fizzed in a free-kick which stung the palms of Stephen Henderson as he touched it round the post for a corner.
And in the 70th minute Feeney put Marquis in on goal, but although the young striker managed to lift his shot over Stephen Henderson, it bounced agonisingly the wrong side of the post.
But the goal finally came 11 minutes later when Feeney floated in a cross, Trotter got the knockdown and N'Guessan reacted first to sweep the ball past Stephen Henderson.
N'Guessan could have made it two as full-time approached but his brave header flew narrowly wide.