This victory was Scotland's first ever win over the Wallabies in Sydney, getting some revenge after suffering one-point losses in their past two meetings against Australia.
The visiting side were the first to hit the scoreboard in the third minute when Greig Tonks slotted a penalty goal to open his account - and Australia had a chance to even the ledger moments later, but the attempt was pushed wide by Foley.
Some sloppy play from the Wallabies handed Scotland the first try of the game in the 15th minute when Duncan Taylor scooped up a loose pass from Tatafu Polota-Nau to stroll over the try-line untouched.
Australia quickly hit back when Israel Folau latched on to a beautiful long-ball from Bernard Foley to crash over the line in the 20th minute, sparking the home side after a slow start.
However, some ill-discipline from Foley put the Wallabies under pressure - when he was shown a yellow card for a shoulder charge on Scottish fly half Finn Russell.
The Scottish playmaker found himself on the end of his sides second try - when he charged down a box kick from Will Genia on the goal line and pushed Scotland's lead to ten points.
Australian spirits were lifted just ahead of half-time when Israel Folau lept to the skies and reeled in a cross-field kick from Bernard Foley, scoring his second for the afternoon.
After the break, Australia started to mount some pressure on Scotland - and a 15-phase attacking chain ended with a brilliant pick-and-go from Will Genia to put the Wallabies ahead for the first time in the 57th minute.
This lead was short lived, as Scotland snatched it back in the 62nd minute following some silky skills on the right-edge which saw flanker Hamish Watson cross over.
Karmichael Hunt's night ended early after he was involved in a heavy collision - but showed great spirit to push away the medical staff and make numerous important tackles before being replaced by Quade Cooper.
Cooper was quick to make an impact on the contest, as he almost put Bernard Foley through a gap will a stunning behind the back pass - but the Scottish defense managed to hang on as Australia continued to probe.
As the minutes ticked down, the Wallabies couldn't find a way through the Scottish pressure - with handling errors, lost lineouts and ruck turnovers proving costly for Australia.
Australia had one final roll of the dice as time expired - but the Scots forced a penalty on the play, ending the Wallabies afternoon with heartbreak.
Tries: Folau 2, Genia
Cons: Foley 2
Tries: Taylor, Russell, Watson
Cons: Russell 2