Wales (16) 26:
Tries: Gibson 3, Bracek, Blackwood
Goals: Harris 3
Lebanon (10) 50:
Tries: Samia, Salem 3, Ndaira, Moujali, Kourouche, Saab, El-Zbaideh
Goals: Toufic 7
Wales failed to qualify for the 2008 World Cup after losing to Lebanon in the repechage on Friday.
The Welsh looked on course to join England, Ireland and Scotland in the finals in Australia when they led 20-10 early in the second half in Widnes.
But after a hat-trick of tries from wing Damian Gibson, they conceded five tries in 22 minutes at the Halton Stadium in Widnes.
Sydney Bulls loose forward Chris Salem was the Lebanon hero with three tries.
Lebanon now advance to face Samoa in Wednesday's repechage final at Featherstone for the 10th and final place at next year's tournament.
The Samoans crushed the USA 42-10 earlier in the evening,
Wales and Lebanon had met just once before at full international level, the Welsh winning 24-22 in their 2000 World Cup pool match in Llanelli.
And they made a dream start in Widnes with two tries in the first nine minutes, both crafted by captain Lee Briers.
The Warrington scrum-half hoisted a pinpoint kick for Gibson to touch down at the corner and then got his Wolves team-mate Andy Bracek charging over from his accurate pass.
Centre Frank Samia pulled a try back for Lebanon on 19 minutes, but it was virtually all Wales, although they only had one more try to show for all their efforts.
Gibson finished off superbly for his second after Luke Dyer collected Briers' floated pass and Iestyn Harris kicked his second conversion to make it 16-6.
The game was then thrown wide open just before the break when Salem split the Welsh defence with an outrageous dummy and crossed for Lebanon's second try.
When Gibson produced some more clinical finishing three minutes into the second half to complete his hat-trick, Wales seemed to have re-established their hold on the game.
But three tries in a 12-minute spell turned it upside down.
Scrum-half George Ndaira, Lebanon's only full-time player who is moving from St George Illawarra to Sydney Roosters for 2008, worked Salem over for his second try and then sped over for one of his own to level the scores at 20-20.
A conversion from Toufic Nicholas put Lebanon in front for the first time before prop Ray Moujali increased the lead on 57 minutes when he forced his way over from close range.
The Welsh defence opened up again all too easily to allow substitute Ali Kourouche to go over, before Salem completed his hat-trick.
Wales briefly stopped the rot with winger Anthony Blackwood scoring a try which Briers converted.
But Lebanon finished well on top as second rower Chris Saab and winger Adham El-Zbaideh added further tries while Nicholas took his goal tally to seven from nine attempts.
Wales: Halley, Gibson, Dyer, Hughes, Blackwood, Harris, Briers, Kopczak, Webster, J. James, M. James, R. Roberts, Joseph.
Replacements: Penkywicz, M. Roberts, Dean, Bracek.
Lebanon: Toufic, El-Zbaideh, A. Saleh, Youssef, Samia, Farah, Ndaira, Moujali, Clark, Deeb, Tackhi, Saab, Salem.
Replacements: Kourouche, Hachache, Chiha, Koborsi.
Referee: Thierry Alibert (France).