The Rossoneri had been expected to cruise into the quarter-finals on the back of their 4-0 victory at San Siro three weeks ago but they found themselves three down on the night by the interval, after first-half strikes from Laurent Koscielny, Tomas Rosicky and Robin van Persie.
However, the Italian champions managed to regroup during the break and ultimately scraped through by the narrowest of margins, much to the relief of Mexes.
"The first half went badly," the France international told Sky Sport Italia. "We were punished for every mistake.
"In the second half we managed to get the ball moving and we had less fear.
"This must not happen again and, after a game like that, you cannot celebrate.
"We want to progress in this competition but we must do better, even if tonight we have gone through."
After surviving an almighty scare in north London, Milan will now be hoping to get back to winning ways against Lecce on Sunday.
How do you stay up to date with football when on the move? With http://m.goal.com – your best source for mobile coverage of the beautiful game.