Angel Di Maria's strike in the 118th minute after a surging counter-attack launched by Messi settled a gritty duel for Argentina as penalties loomed at Sao Paulo's Corinthians Arena.
The result was cruel on Switzerland, who looked to have done enough to take the game to a penalty shoot-out with a disciplined defensive display that Argentina rarely looked like threatening.
But with two minutes left, Swiss fullback Stephan Lichtsteiner was caught in possession near halfway.
Messi accelerated clear, and after hurdling Fabian Schar's attempt to bring him down, slipped a pass to Di Maria who swept the winner past Diego Benaglio.
Switzerland almost hit back with a dramatic equaliser but Blerim Dzemaili's downward header cannoned off the foot of the upright.
Messi's decisive contribution to the winning goal was enough to earn him a fourth consecutive man-of-the-match award in four games at the World Cup.
Argentina will now meet the winner of the final second round between Belgium and the United States in the last 16.
Belgium are waiting anxiously on the fitness of their talismanic captain and centre-back Vincent Kompany, who is struggling with a niggling groin injury.
However, Wilmots said even without Kompany the 'Red Devils' should go through to their first World Cup quarter-final since 1986 and if they slipped up he would consider it a "failure".
The 45-year-old former international striker -- who is Belgium's all-time scorer at the finals with five in the three World Cups he played at -- also batted away criticism of the unconvincing manner in which his side won their three group games.
"I let people make their complaints, we just advance. We are not going to bang our heads against the wall," he said.
Off the pitch, FIFA declined to comment on allegations of matchfixing involving Cameroon's ill-fated World Cup campaign.
Cameroon's football federation (FECAFOOT) said in a statement on Monday it had launched an investigation into a Germany press report which alleged a Singaporean match-fixer had correctly predicted the team's losing 4-0 scoreline in their Group A defeat to Croatia, as well as a first-half sending off.
Football's governing body FIFA said it could not comment on an ongoing investigation.
"Speaking generally, the integrity of the game is a top priority for FIFA and as such we take any allegations of match manipulation very seriously," a statement said.
Elsewhere Monday, it was confirmed Dutch midfielder Nigel De Jong will almost certainly miss the remainder of the World Cup after suffering a torn groin muscle.
The Dutch Football Association (KNVB) said on its Twitter feed De Jong would "probably" be sidelined for two to four weeks, ruling him out of the remainder of the tournament.
The holding midfielder limped off early in Holland's 2-1 win over Mexico on Sunday.
"Nigel de Jong has tear in groin muscle. He's probably off 2 to 4 weeks," the KNVB announced on Twitter.