The stage was set for two modern greats to sign off on an emotional afternoon, but it was to the future that Wales cast its collective gaze.
Shane Williams and Martyn Williams said farewell on turf they have graced for more than a decade, the latter becoming only the third Welshman to win 100 caps. But the players in possession of "their" jerseys, as well as a 19-year-old wing and a resurgent James Hook, secured Wales' sixth successive win, ahead of the tour to Australia.
The flanker Justin Tipuric reminded Sam Warburton that he has competition for Martyn Williams' old No 7 jersey and Aled Brew, wearing Shane Williams' 11, wrapped up victory in the final minute. On the other wing, the 5ft 9in Harry Robinson marked his Test debut with a blistering 40-metre try. The game also marked a return to form for Hook, who had suffered an alarming fall from grace at the World Cup. He contributed 20 points, including his first Test try in 15 months.
Wales's caretaker coach, Rob Howley, said: "James was struggling with a virus this week but showed again he is hugely talented. He has time on the ball, scored a great try and his kicking was exceptional. He kept his composure to nail the conversion from out wide, which has sometimes not happened in the past."
Howley has cut Dan Biggar, Ryan Bevington, Martyn Williams, Will Harries and Adam Warren from his 34-man squad to face the Wallabies. He has retained three new caps, Robinson, Rhodri Jones and Liam Williams.
Howley said: "Harry [Robinson] is almost Shane-esque in the excitement he creates when he is on the ball but this was an important game for the development of a lot of young guys. We lost our way in the middle of the game but we showed character and guts and winning helps create momentum for Australia."
Sadly, two Shane Williams turnovers began and ended Wales's success. First, Tipuric stole possession and Robinson left the former All Black full-back Mils Muliaina with little chance.
The Barbarians' coach, John Kirwan, said: "All I could think was, 'Here comes another one.' Wales see one wing retire and have another already waiting, to their credit."
Hook took Wales to a 13-point lead before Stephen Donald scored twice and Richie Rees once to put the Baa-Baa's 21-16 ahead. Hook scored eight minutes from time before Brew took Williams's loose pass to seal the win.
Wales L Williams (Scarlets); H Robinson (Blues), A Bishop (Ospreys), J Hook (Perpignan), A Brew (Dragons); D Biggar (Ospreys), L Williams (Blues); R Gill (Saracens), M Rees (capt), R Jones (both Scarlets), AW Jones, I Evans (both Ospreys), J Turnbull (Scarlets), R Jones, J Tipuric (both Ospreys). Replacements P James (Ospreys) for Gill, 45; M Williams (Blues) for AW Jones, 46; A Shingler (Scarlets) for R Jones, 51; R Webb (Ospreys) for L Williams, 51; A Warren (Scarlets) for Biggar, 64; R Hibbard (Ospreys) for Rees, 68; W Harries (Dragons) for Robinson, 68.
Barbarians M Muliaina (New Zealand); I Nacewa (Fiji), C Laulala (New Zealand), M Tindall (England), S Williams (Wales); S Donald (New Zealand), R Rees; D Jones (both Wales), B August (France), J Smit (capt, South Africa), M O'Driscoll (Ireland), M Chisholm (Australia), F Louw (South Africa), J Beattie (Scotland), M Gorgodze (Georgia). Replacements A van Zyl (Stade Français) for O'Driscoll, 40; A de Malmanche (New Zealand) for August, 40; S Tagicakibau (Samoa) for Laulala, 46; N Tialata (New Zealand) for Smit, 46; A Qera (Fiji) for Gorgodze, 56; R Lawson (Scotland) for Rees, 57; C Heymans (France for Muliaina, 66.
Referee A Rolland (Ireland).
Tries: Robinson, Hook, Brew
Cons: Hook 3
Pens: Hook 3
Tries: Donald 2, Rees
Cons: Donald 3