With the group on a knife edge heading into the final round of fixtures, Mexico conceded a last-gasp goal in a 2-1 victory over Saudi Arabia, sending Poland through after it had seemed for much of the second half that they would advance purely on fair play rules.
Second-half goals from Premier League duo Alexis Mac Allister and Julian Alvarez ensured Argentina progressed after Lionel Messi had a controversial penalty saved by Wojciech Szczensy.
Messi will now lead Argentina out versus Australia in the next round, while Poland's reward for squeaking through is a tough test against reigning champions France.
Playing the 999th game of his senior career, Messi had two early chances saved by Szczesny as he struggled to get into the contest, with Robert Lewandowski suffering from a similar issue at the other end of the pitch.
Marcos Acuna arrowed an effort wide just before the half-hour and Szczesny had to be alert to tip a dipping Angel Di Maria corner over the crossbar soon after.
Juventus goalkeeper Szczesny was again called into action to turn away an Alvarez shot but in attempting to claim a cross from the rebound he caught Messi with a stray hand, the VAR alerting referee Danny Makkelie to the incident.
The Dutch official contentiously pointed to the spot after viewing a replay on his pitchside monitor but any angst Szczesny felt at the call was relieved as he brilliantly turned away Messi's penalty, his second save from the spot in Qatar.
But there was nothing the former Arsenal player could do just two minutes into the second half as Mac Allister's first Argentina goal put his side ahead.
The scuffed strike was the first goal Szczesny has conceded in the tournament and needed to give Poland a wake-up call which never came.
Having set out not to concede and Lewandowski isolated for so much of the game, Poland could not switch things on in the final third, - Mac Allister coming close to a second only to this time see his low shot saved.
Argentina secured the win, and progression as group winners despite their shock defeat to Saudi Arabia, with a well-taken second as Manchester City forward Alvarez curled home from Enzo Fernandez's pass.
At that stage of the contest, Poland were progressing by virtue of picking up three fewer bookings than Mexico.
Grzegorz Krychowiak's yellow card with 12 minutes remaining shortened that margin further, while Lautaro Martinez passed up a decent chance to score a third for Argentina and send Poland packing.
Head coach Czeslaw Michniewicz cut a frustrated figure as Poland fans in the stands at Stadium 974 anxiously checked their phones for updates.
Substitute Nicolas Tagliafico almost added a crucial third but his clipped effort was cleared away from the back-tracking Jakub Kiwior as Poland survived once more.
Full-time arrived in Doha three minutes before the whistle was blown at Lusail Stadium, where Mexico conceded in stoppage time - Poland's players celebrating on the pitch after huddling around to watch the closing stages.