Tim Murtagh smashed a six and a four in the final over as Ireland ended Scotland's hopes of automatic World Cup qualification with a dramatic one-wicket victory with a ball to spare in Belfast.
Ireland's last pair needed nine from the last three balls and Murtagh hit Rob Taylor for a maximum down the ground and followed up with another boundary.
Scotland had sensed victory when Max Sorensen had been stumped off the bowling of Matt Machan in the penultimate over after making 31.
Prior to that Ireland had slumped from 95 without loss to 180-8 in pursuit of 224, Majid Haq taking 3-26.
Scotland posted 223-9 from their 50 overs thanks largely to an unbeaten 91 from their South African-born captain Preston Mommsen.
Although wickets fell at regular intervals, Mommsen shared in important partnerships of 60 for the fourth wicket with Calum MacLeod (21) and 44 for the ninth with Safyaan Sharif (26).
Mommsen hit 10 fours in his 122-ball knock, holding the innings together after Machan's promising start was ended on 27 by Sorensen.
Somerset spinner George Dockrell, who struggled in the one-day clash with England earlier this week, was the pick of the Irish bowling with 4-24 from his 10 overs, while Sorensen took 2-37.
Ireland captain William Porterfield, who scored a century against England, carried on where he left off in Malahide with an assured 62 from 64 balls with 10 fours.
But he fell soon after the dismissal of his opening partner Paul Stirling (30) and Ireland struggled to recover the momentum.
Former captain Trent Johnston did weigh in with 24 from 34 balls but it was not until Sorensen got to work, putting on 29 for the ninth wicket with Murtagh, that hopes were truly revived.
It seemed over when Sorensen swung and missed after coming down the pitch to Machan, but Murtagh held his nerve.
The defeat means Scotland, who play Ireland again in their final game on Saturday, can no longer climb into the eight-team competition's second qualification spot. They will have one last chance in a qualification tournament next year.
Ireland, the leaders of the WCL, have already booked their place at the 2015 World Cup in Australia and New Zealand.