|Scotland (4) 22|
|Tries: Addy 2, Toal, Ferguson Goals: Brough 3|
|Ireland (18) 24|
|Tries: Cosgrove, Hargreaves, Ambler, Grix Goals: Finn 4|
A late Scott Grix try helped Ireland claim their first win in this year's European Championship, sending title-holders Scotland to a second defeat.
Two tries by Luke Ambler and one from Brad Hargreaves helped the Irish into a 18-4 lead at the break.
Danny Addy added to his first-half score with Shane Toal and Dale Ferguson also crossing to put the Scots ahead.
But Grix crossed to level the score and Liam Finn's conversion gave Ireland victory.
And with Wales and France on one win apiece going into their meeting in Cardiff next Friday, the Scots' hopes of defending the title are over.
But it was the visitors who took the initiative in the first half with Ambler going over and Finn converting, and Hargreaves was next to touch down.
Addy got Scotland's first try but Danny Brough was unsuccessful with the conversion attempt.
Ambler crossed to set up another Finn conversion and a penalty from the Castleford player followed before the break.
Scotland's second-half comeback was led by Addy and Brough converted from under the posts. Toal's try and Brough's successful kick brought the hosts to within two points and Ferguson's try gave them the lead for the first time.
Another Brough conversion opened up a four-point gap but Ireland were to have the last word.
Huddersfield's Grix finished off a Ben Johnston break and Finn's conversion gave the visitors the edge. And that proved to be enough for the Irish in front of a near 2,000-strong crowd in the Scottish Borders.
Scotland squad: Danny Addy, Dale Ferguson, Corbyn Kilday, David Scott, Lewis Clarke, Scott Plumridge, Craig Robertson, Joe McClean, Danny Brough, Sonny Esslemont, Adam Walker, Johnny Walker, Ben Hellewell, Oscar Thomas, Alex Walker, Liam Hood, Richard Harris, Ben Kavanagh, Harvey Burnett.
Ireland squad: Gareth Gill, Elliot Cosgrove, Sean Hesketh, James Mendeika, Oli Roberts, Liam Finn, Luke Ambler, Ben Johnston, Scott Grix, Gregg McNally, Bob Beswick, Joe Keyes, Casey Dunne, Will Hope, Graham O'Keeffe, Brad Hargreaves, Danny Bridge, Matty Hadden, Callum Mulkeen, Dave Allen, Colton Roche.