Ireland warmed up for their tour of New Zealand with a 29-28 defeat to the Barbarians at Kingsholm.
The Barbarians led 19-14 at half-time thanks to tries from Iain Balshaw, Cornelius van Zyl and Paul Sackey.
Craig Gilroy and Keith Earls scored for Ireland, who moved ahead with a Simon Zebo try early in the second half.
Mike Tindall went over for the Barbarians but a Gilroy try put the Irish back in front before Felipe Contepomi won it with a late penalty.
The Kingsholm crowd of 11,654 was firmly behind the Barbarians as the invitation side contained a number of players with Gloucester associations, and they were deserved winners being the more competitive side throughout.
Barbarians had the better of the opening exchanges and should have taken an early lead but Cedric Heymans failed to provide Sackey with a scoring pass with the try-line at the wing's mercy.
However the invitation side continued to camp in the opposition 22 and took a 10th-minute lead.
Tindall, the home-crowd favourite, made a half break and from the ensuing ruck the ball was moved wide for Sackey to send former Gloucester star Balshaw over for a try in the corner which Contepomi converted with a splendid kick.
Stung by the score, Ireland responded and debutant Gilroy finished strongly for a try which captain Ronan O'Gara converted to tie up the scores.
Georgian flanker Mamuka Gorgodze and Tindall were the most impressive players during the opening quarter and they provided some powerful running to set up the Barbarians' second try for Benetton Treviso lock Van Zyl.
Back came Ireland with their second try when Gilroy produced a stunning burst down the right flank to evade both Balshaw and Tindall and set up a try for Earls. O'Gara converted to put his side in front for the first time.
Barbarians regained the lead after 28 minutes when, following a penalty award just inside the Irish half, the alert Sackey caught Ireland's defence napping and raced away for the try which Contepomi converted.
Within five minutes of the restart, Ireland had regained the lead. A clever pass from O'Gara gave Zebo a chance to outflank a hesitant Sackey for the try which O'Gara converted.
The Gloucester crowd then had two moments to savour.
They first gave Balshaw a huge ovation as he was substituted and moments later they roared as Tindall crashed through the Irish defence for a try which Contepomi converted.
The lead changed hands once again as the impressive Gilroy received a long pass from Earls for an easy try which O'Gara again converted.
Then, with three minutes remaining, Barbarians were awarded a penalty in the Irish 22 and for the first time in the match, a kick at goal was chosen and Contepomi was successful to win the match.
Barbarians: Heymans, Sackey, Tindall, Traille, Balshaw, Contepomi, Lawson, Jones, August, Afoa, O'Driscoll, C. van Zyl, Gorgodze, Louw, Lakafia.
Replacements: Donald for Heymans (66), Nacewa for Balshaw (55), Rees for Lawson (70), Tialata for Jones (55), de Malmanche for August (41), Taele for C. van Zyl (24), Qera for Gorgodze (65).
Ireland: Earls, Gilroy, Cave, Wallace, Zebo, O'Gara, Murray, Wilkinson, Sherry, Fitzpatrick, Tuohy, Ryan, Muldoon, Henry, O'Mahony.
Replacements: Spence for Gilroy (78), Marshall for Murray (77), Loughney for Fitzpatrick (57), O'Callaghan for Tuohy (60), Coughlan for Henry (60), Trimble for O'Mahony (70).
Not Used: Best.
Ref: Jerome Garces (France).