Skipper Greig Laidlaw rescued a win for scrappy Scotland as he slotted over a last-gasp penalty to seal a 19-16 win over Argentina.
The Dark Blues put on a error-strewn display but did just enough to see off the Pumas at Murrayfield.
There was little to separate the teams before Nicolas Sanchez scored the opening try for the visitors five minutes after half-time. But Scotland hit back with wing Sean Maitland's touchdown just four minutes later.
Vern Cotter's men were devastated when they allowed Australia to snatch victory with a late penalty last week but this time it was Laidlaw who was celebrating as he booted over in stoppage time.
His 14-point contribution could yet prove vital for Scotland's World Cup hopes as they now climb above the South Americans to eighth place in the World Rugby rankings.
The draw for Japan 2019 will be made next May and if Scotland can maintain their new position they should avoid having to take on two major nations in the opening pool phase.
Scotland had won four of the last five meetings against the Pumas but their record in Edinburgh against Argentina was less impressive, with the Dark Blues having come out on top on only two of their six head to heads in the capital.
The hosts put on a stunning light show before kick-off but that was where the fireworks ended as both sides struggled with the simplest of manoeuvres.
Laidlaw slotted over a third-minute penalty after the Argentines had been caught out by Finn Russell brilliant retrieval of his own up-and-under.
But the Scots were struggling to get a foothold at the set-piece, with their 20-year-old prop Zander Fagerson - earning just his third cap - receiving a lesson in Test-level scrummaging by wily Argentine prop Lucas Noguera.
The South Americans were forcing Scotland into mistakes around the breakdown - yet they were hardly putting on a spotless display themselves.
Martin Landajo thought he had spotted a chink in the Dark Blues defence when he booted a grubber in behind but full-back Joaquin Tuculet was beaten to the loose ball by the home side's Tommy Seymour.
Tempers briefly flared before Kiwi referee Ben O'Keeffe restored order but Scotland found it difficult to land a telling blow.
Laidlaw was guilty of throwing some pretty rotten passes while Cotter was seen thumping his desk in frustration as his line-out misfired badly.
Ross Ford temporarily replaced Brown as the hooker went off to have a head knock assessed but the veteran's introduction made an immediate impact on Scotland's scrum. With the Pumas forced backwards for the first time, Laidlaw was given another simple penalty 27 minutes in.
Argentina have gained themselves a reputation for swashbuckling rugby and gave a brief show of their capabilities as Matias Orlando, Juan Martin Hernandez and Santiago Cordero combined to draw their side within sight of the Scots' try-line.
The hosts, though, were able to scramble back into position as a brave rearguard effort held their opponents up an inch short of scoring.
Sanchez did, however, nail a monster 45-yard penalty straight through the posts to half the deficit just before the break.
The Pumas stand-off slotted over another kick four minutes after the restart as Scotland wandered offside.
Scotland were then caught napping as Hernandez lobbed a clever cross-field kick to the left flank. Maitland failed to spot Orlando's run in behind and the Argentine centre bulldozed his way past Stuart Hogg before dotting down the opening try.
Sanchez put the conversion over but the Scots made immediate amends. They swarmed over the visitors and wrestled back possession before driving up field. Huw Jones then took his side into the danger zone before popping off to Maitland, who dived over in the corner.
The angle was against Laidlaw but his nerveless kick for the extras levelled up the scores.
Fagerson made way for Exter's Moray Low but he could not improve Scotland's display at the scrum. An almighty heave from the visiting pack virtually trampled its way over the hosts to win a penalty which Sanchez put over to once again put his side ahead with 16 minutes remaining.
Scotland turned up the pressure though and hit back with another Laidlaw penalty but Finn Russell skewed a drop-goal attempt a fraction wide.
Laidlaw thought he had let victory slip through his hands when he smashed a penalty against the upright. But with the clock already showing the 80 minutes was up O'Keeffe gave him one more go after spotting an Argentine infringement and this time he made no mistake.