Papua New Guinea secured a quarter-final against hosts England in impressive style as they ended Wales' faint Rugby League World Cup hopes.
Kyle Laybutt, Nixon Putt, Jimmy Ngutlik and Dan Russell all crossed for PNG in a one-sided first half in Doncaster.
Wales' chances were few and far between, with Kyle Evans just failing to reach a chip kick to score.
The Kumuls turned the screw after the break, adding further tries through player of the match Putt and Ngutlik.
PNG can now look forward to what should be a thrilling encounter against England in Wigan this Saturday on Guy Fawkes Day, while there also promises to be fireworks between Group D winners Tonga and Samoa in Warrington the following day.
Despite losses to Cook Islands in their opening game and then to Tonga, Wales entered the final pool encounter still with an outside chance of reaching the knockout stages.
However, that would have required Wales not just to find a victory - and end a winless run at World Cups stretching back to 2000 - but to beat hot favourites PNG by 22 points or better.
John Kear's side were boosted by Ollie Olds recovering from a shoulder knock to take his place at stand-off, in a side showing three changes from the Tonga defeat at St Helens a week ago.
Will Evans, Rhodri Lloyd and Mike Butt returned, with Tom Hopkins, Dalton Grant and Luke Thomas the trio to make way.
Stanley Tepend made three changes to his PNG squad, all coming in the pack, where Watson Boas, Sylvester Namo, McKenzie Yei made way for prop Zev John, hooker Wesser Tenza and second row Sherwin Tanabi.
Wales had beaten the Kumuls twice previously, in 1991 and 2000 when the Dragons were in their pomp, but a shift in the balance of power was all too clear when Wales lost 50-6 in the last meeting between the two teams, at the 2017 World Cup.
That had been in the scorching heat and 98% humidity of Port Moresby, but conditions in Doncaster were very different, with a steady downpour that made handling slick and defending kicks tricky.
Wales had led against both Cook Islands and Tonga but there was to be no Halloween scare for PNG, who claimed two tries within the first dozen minutes at the Eco-Power Stadium to settle any nerves.
First Laybutt squeezed around Bailey Antrobus' despairing dive, before Putt crashed over from a yard on the last tackle. Kumuls skipper Rhyse Martin converted both for a 12-0 lead.
Dan Russell stretches to score Papua New Guinea's fourth try against WalesEvans almost had Wales on the scoreboard but the winger was just unable to gather Olds' clever chip into the in-goal area.
The Dragons at least thought they had some much-needed field position, but then were slow to mark up at a PNG play-the-ball and Ngutlik took spectacular advantage.
The Wests Magpies winger spotted the gap from within his own half and scorched away to dot down under the posts, claiming his first try for his country on just his second appearance.
Under pressure from PNG's speed at each play-the-ball, Wales were giving up set after set and conceded a fourth try as interchange Russell stretched out a telescopic arm to ground the ball just over the line - stretching the lead to 24-0 at half-time.
Wales were again all hands to the pump after the restart to repel wave after wave of attacks while making very little ground themselves.
The pressure eventually told and second row Putt took two tacklers over the line with him for his second try, with Martin keeping up his 100% record with the boot.
Wales could have crumbled, but again showed the spirit that has won them so many admirers in this tournament, steadying the ship with renewed vigour in defence and flair in attack.
Joe Burke and Connor Davies were both stopped just short, before Evans lost the ball in the tackle as he surged towards the line.
Evans compounded that error moments later as he failed to gather an admittedly vicious steepling kick, allowing Ngutlik to poach his second try of the night and send Papua New Guinea into the quarters in style.
Wales coach John Kear:
"I thought the first half we were pretty poor, we gave a better account in the second half but our kicking game was indifferent.
"In the first half we gave away so many six-agains, penalties, we just didn't give ourselves a chance, we didn't do the basics well.
"But all the time they worked hard for each other in defence and I think they've done that throughout, but second half was much better.
"With this type of weather you can only go one way and that's very direct, and I think that probably suited the Papuans more than us because they play the game very physically."
Papua New Guinea coach Stanley Tepend:
"We had our plan to do well in the pool stage, get through to the quarter-finals and we've done that... the boys did well today.
"We spoke at half-time that we wanted to keep going, but we defended more sets in the second half - but credit to the boys they defended well on the try line there.
"It just means they're playing for each other which is a good sign... obviously England are a really, really good team and it'll be a big test for us but we'll go back and get ourselves right."
Papua New Guinea: 1. Alex Johnston, 20. Rodrick Tai, 3. Nene Macdonald, 4. Justin Olam, 19. Jimmy Ngutlik, 6. Kyle Laybutt, 7. Lachlan Lam, 8. Wellington Albert, 9. Edwin Ipape, 17. Emmanuel Waine, 11. Nixon Putt, 12. Rhyse Martin (c), 13. Jacob Alick.
Interchanges: 14. Wesser Tenza, 15. Dan Russell, 21. Sherwin Tanabi, 22. Jeremiah Simbiken.
Wales: 1. Caleb Aekins, 22. Kyle Evans, 4. Will Evans, 6. Elliot Kear (c), 2. Rhys Williams, 14. Ollie Olds, 7. Josh Ralph, 8. Anthony Walker, 9. Matty Fozard, 24. Gavin Bennion, 11. Rhodri Lloyd, 17. Bailey Antrobus, 16. Joe Burke.
Interchanges: 10. Dan Fleming, 12. Chester Butler, 15. Curtis Davies, 18. Connor Davies.
Referee: Gerard Sutton.