The Scots had dominated the Pool B game for large periods and when Dan Parks stretched their lead to 12-6 with seven minutes to go, they looked to be home and dry.
But disaster struck as Argentinian replacement Lucas Gonzalez Amorosino glided his way through some feeble defence down the left wing for a try Felipe Contepomi converted for a sensational victory.
Replacement flyhalf Dan Parks attempted a last-minute drop-goal but his left-footed effort went wide, while Argentines were lucky not to have been called offside by English referee Wayne Barnes in their bid to charge the kick down.
"Thirty seconds of madness has really cost us," lamented Scotland coach Andy Robinson. "We lost a game of rugby. We got to 12-6 and I felt like we were in control of the game. The reason we lost the game was a lapse of concentration.
"We've got to take our hats off to Argentina to be able to find a way to win the game in the second half. I think in the second half they were outplayed, but they managed to find an answer.
"It's about being able to finish teams off. We're playing in the best tournament in the world. You've got to be able to finish sides like Argentina off.
"To score a try the way they did, it was Argentina that wanted to win. They took their chance well and won the game. They had to find some answers and they did."
Scotland's defeat has left them a mountain to climb to sneak into the quarter-finals, having to record a victory over unbeaten England next weekend, while Argentina play the much weaker Georgia.
But Robinson, a former England international flanker and ex-coach, said his "grieving" team would come out all guns blazing against the auld enemy.
"Come 8:30 next Saturday, there will be a Scotland side very fired up and a Scotland side capable of winning the game," he said.
Robinson added that Barnes' decision not to award Scotland a penalty for offside during Parks's second attempt at a drop-goal had been marginal.
"In all sport there's lots of ifs and buts, there's small margins and small calls," the former Bath stalwart said.
"Barnes didn't give the call. We're disappointed he didn't, but that's sport. We have all had it go the other way".
"Wayne, he's a quality referee. I've gone and had a chat with him after the game and congratulated him on his game," a smiling Robinson added.