Garryowen's Jeremy Staunton produced a virtuoso performance as Ireland beat South Africa in a memorable encounter at the Sydney Show Grounds in the SANZAR Invitational Under-21 Championship.
The result guaranteed Ciarβn Fitzgerald's charges fifth place in the eight-team tournament.
Ireland led 23-18 at the interval, Staunton kicking three penalties and crossing for a try, which he converted. He then added the extra points to a try by Blackrock College wing Gary Brown.
South Africa hit back after the interval and their tries came from De Villiers (two), Van Niekerk, Booi, and van der Linde.
The South Africans led 42-33 with just 10 minutes remaining but the Irish produced a storming finale. They scored second half tries through Brown - his second - and replacement openside flanker Shane Jennings.
While Ireland will rue the fact that they were beaten 15-10 by England in their opening match, with their poorest performance in the tournament, they acquitted themselves well thereafter.
They beat Argentina and at half-time in the New Zealand game trailed only 16-12 before having a man sent off and losing 44-18.
The baby All Blacks confirmed their billing as the top side in the competition by hammering Australia 30-13 in the final. France dismissed England 36-6 in the third and fourth place play-off.
IRELAND: G Duffy (Galwegians); S Young (Ballymena), K Lewis (St Mary's), M Lawlor (Shannon, capt), G Brown (Blackrock); J Staunton (Garryowen); B O'Riordan (UCD); S Phillips (Saracens), G Hickie (St Mary's), N Treston (Blackrock); D Browne (Galwegians), N Breslin (UCD), P Malone (Bruff), A Hickey (Dolphin), N McMillan (Belfast Harlequins). Replacements: S Jennings (St Mary's) for McMillan; R Flanagan (Bruff) for Phillips; D Dillon (UCD) for Breslin; (C O'Sullivan (UCC) for Lawlor.