Declan Kidney's men had not lost in Edinburgh since 2001 and looked on course to continue that run as they dominated play early on.
But despite having close to 80% possession there was just three points between the sides as the first half came to a close, with a Paddy Jackson penalty making the difference.
A sensational try from Craig Gilroy gave the Irish the lead they deserved on 44 minutes, but Jackson's conversion attempt came back off the post.
Then, after Ireland failed to make the most of their early advantage, Scotland turned the game around with four straight penalties from Greig Laidlaw, to leave the visitors wondering how they had lost a game they looked in control of.
They will now face France in their penultimate game of the tournament knowing their challenge is effectively over.
And the poor result will increase the pressure on Kidney, who lamented his team's inability to capitalise on their chances.
"It is about taking your opportunities," he said. "We created several for ourselves but didn't manage to convert them enough to be ahead of Scotland's penalty count.
We created opportunities today. I will take a good look at myself and get the others around me to critique everything that I'm doing, as well as them too, because nobody is immune from this.
"I think it is too easy to put it down to that (Jackson's misses). We also created a lot of try-scoring opportunities and if we had put those away...
"Obviously their place-kicking went to a far higher stat than ours and that is something we regret, but we did do a lot of positive work as well in attack.
"We just didn't manage to finish it off."
Kidney's decision to play the uncapped Ulster duo of Luke Marshall and Paddy Jackson yielded mixed results for the injury-depleted side.
In a match that was decided by the finest margins Jackson missed eight points from the kicking tee, including two penalties and a conversion.
It was in sharp contrast to Laidlaw who slotted home three penalties for the hosts.
Meanwhile Marshall's powerful running at inside centre was a key feature of the Irish attack and he looked comfortable at this level.
Ronan O'Gara, who had been left on the bench, came on at fly-half in place off Jackson with 15 minutes to go but the change failed to stop the rot.
The game came to a grandstand finish as Ireland pushed for a try that could have seen them snatch victory, with the Scots conceding a penalty on a set-piece in injury-time, but Marshall knocked on in midfield and the game was over.
When asked if there will be questions about his role after the defeat, Kidney said: "There always is, but it is just about getting ready for the next game in two weeks' time.
"That is what the role is; whether you win, lose or draw it doesn't matter - it is all about getting ready for the next game."