Isa Nacewa broke Welsh hearts with a last-minute try to give the Barbarians a memorable win in Cardiff.
The full-back raced clear for his second try, with Iesofa Tekori, Sergio Parisse and Mathieu Bastareaud also crossing for the Baa-Baas.
Gavin Henson, in his first Wales game for two years, gave the pass that let wing George North open the scoring.
Wales coach Warren Gatland will also have been pleased with tries for Morgan Stoddart, Mike Phillips and Aled Brew.
But the highlight would have been the manner in which the Wales forwards took on their more experienced opponents, despite some early wobbles at the set piece.
Wales began with 10 changes from the side that started the 28-9 Six Nations defeat by France, leaving them with only one established combination in half-backs Mike Phillips and Stephen Jones.
Elsewhere, debutants Ryan Bevington - at loosehead prop - and number eight Toby Faletau were up against two of the world's most highly-rated operators in ex-All Black Carl Hayman and Italy captain Sergio Parisse, who also led the Baa-Baas on this tour.
The Barbarians kicked off the match one game further into their team development, having seen off an England XV 38-32 six days earlier at Twickenham.
And while the Baa-Baas could count on a backbone of Test player, they had two uncapped starters in fly-half Brock James and Cardiff Blues lock Paul Tito.
They had two more on the bench in Tito's scrum-half team-mate Lloyd Williams and Willie Mason, an experienced Australian rugby league star who has recently switched to union with Toulon, and who has experienced the 15-a-side code for the first time on this tour.
The Baa-Baas were not only superior up front on paper. They also gave Wales a torrid indication of what was to come with a series of powerful scrums deep in the home 22 in the opening minutes.
Wales were penalised three times in the first four minutes, twice at scrums and once at a defensive ruck.
But their defence held firm and when Fiji's Seru Rabeni held on at a tackle, Wales were able to clear the immediate danger.
With their scrum under stress Wales desperately needed a solid line-out, but that also prove frail at the first time of asking.
Warren Gatland's side needed a boost and after establishing their first attacking platform, with a move that swept right, left and right again, Gavin Henson's miss-pass gave North the chance to go over.
The nagging fear that the tourists' pack could prove too much for Wales returned as their line-out problems helped create a moment's hesitation, as a set move ended with scrum-half Mike Phillips gifting an intercept pass to James.
Clermont Auvergne's Australian fly-half broke free and after Joe van Niekirk's run, Samoa's Tekori powered over.
James failed to convert, but made amends after Parisse charged from a scrum for scrum-half Sebastien Tillous-Borde to send Leinster and Fiji star Nacewa over.
Having benefitted from an interception, the Baa-Baas conceded one when Stoddart took Tito's pass to race 65 metres down the touchline to score, fly-half Jones converting.
But the Baa-Baas were back in the lead, 19-14, at the break as Parisse made the most of his side's scrum power to go over for James to convert.
Wales were down to 14 men when Brew was sin-binned for a high tackle on Paul Sackey three minutes after the break.
But a minute later the Baa-Baas were a forward short when Tekori was yellow-carded for illegal ruck work.
Sam Warburton set off after intercepting only to give the ball back to the Baa-Baas for James to clear, but back came Wales with Faletau's powerful ball-carrying evident on two charges.
Barbarians flanker Martyn Williams thwarted his countryman on one occasion, but the hosts were not to be denied at the umpteenth close-range attempt, Phillips eventually going over to level.
Jones converted and as he did so Williams was replaced by George Smith.
Henson's Wales return ended after 61 minutes, replaced by Scarlets debutant Scott Williams.
At the same time Cardiff Blues prop Scott Andrews made his Test bow, but centre Williams was the instant hit with a telling break with his first touch.
Newport Gwent Dragons hooker Lloyd Burns joined the new caps in the 64th minute, a day after getting married and at the end of a season which he began in the Welsh Premiership at Cross Keys.
Wales' line-up was getting younger by the minute and that youth and enthusiasm paid dividends ahead of Priestland's arrival as Brew smashed his way over from close range.
Rhys Priestland was added to the youthful faces when he took over from Jones, whose final act on his record-equalling 100th appearance for his country was to convert Brew's score.
The visitors also introduced fresh blood, uncapped Blues scrum-half Williams among them.
But the man who made the biggest impact was Willie Mason, taking out three defenders with a back-handed pass to for French midfield wrecking ball Mathieu Bastareaud to touch down.
That left the Bas-Baas four points down going into the last six minutes and they rose to that challenge, two more excellent off-loads allowing Nacewa to race clear and James converted to seal back-to-back wins over England and Wales.
Wales: Morgan Stoddart (Scarlets); George North (Scarlets), Jonathan Davies (Scarlets), Gavin Henson (Unattached), Aled Brew (Newport Gwent Dragons); Stephen Jones (Scarlets), Michael Phillips (Ospreys); Ryan Bevington (Ospreys), Huw Bennett (Ospreys), Paul James (Ospreys), Ryan Jones (Ospreys), Luke Charteris (Newport Gwent Dragons), Danny Lydiate (Newport Gwent Dragons), Sam Warburton (Cardiff Blues, capt), Toby Faletau (Newport Gwent Dragons).
Replacements: Lloyd Burns (Newport Gwent Dragons), Scott Andrews (Cardiff Blues), Alun Wyn Jones (Ospreys), Josh Turnbull (Scarlets), Tavis Knoyle (Scarlets), Rhys Priestland (Scarlets), Scott Williams (Scarlets).
Sin Bin: Brew (44).
Barbarians: Isa Nacewa (Leinster and Fiji); Paul Sackey (Toulon and England), Seru Rabeni (La Rochelle and Fiji), Mathieu Bastareaud (Stade Francais Paris and France), Doug Howlett (Munster and New Zealand); Brock James (Clermont Auvergne), Sebastien Tillous-Borde (Castres Olympique and France); Iestyn Thomas (Scarlets and Wales), Sebastien Bruno (Toulon and France), Carl Hayman (Toulon and New Zealand), Iosefa Tekori (Castres Olympique and Samoa), Paul Tito (Cardiff Blues), Joe van Niekerk (Toulon and South Africa), Martyn Williams (Cardiff Blues and Wales), Sergio Parisse (captain, Stade Francais Paris and Italy).
Replacements: Leonardo Ghiraldini (Benetton Treviso and Italy), Davit Kubriashvili (Toulon and Georgia), Erik Lund (Biarritz Olympique and Norway), George Smith (Toulon and Australia), Lloyd Williams (Cardiff Blues), Willie Mason (Toulon), Benoit Baby (Clermont Auvergne and France).
Sin Bin: Tekori (45).
Referee: Alain Rolland (IRL)