Twenty-three-year-old Pedersen proved the strongest of an unpredictable leading trio after almost six and a half sodden hours in the saddle, the Dane kicking past the experienced Trentin in Harrogate, as a resigned Kung settled for third in the 261-kilometre battle of attrition.
Pedersen looked to have been dropped on the ninth and final climb of Oak Beck with just over five kilometres remaining when Kung’s tempo ended the chances of Trentin’s Italian teammate Gianni Moscon.
But Pedersen - a runner-up in the Tour of Flanders in 2018 and a silver medallist behind Van der Poel in the 2013 junior World Championships road race - rallied before making light of his tender years to zip past 30-year-old Trentin on the home straight after the final leg-sapping ride up the ramp on Parliament Street.
Shock Pedersen win sparks ecstatic scenes in Denmark camp
Moscon took fourth place at 17 seconds before the former triple World Champion Peter Sagan finished fifth, the Slovakian showman leaving it too late with his last-ditch attack from the chasing pack.
Youngster Van der Poel looked a shoo-in to cap his meteoric rise to cycling stardom with a rainbow jersey after joining the winning move with Trentin inside the final 35km.
But the 24-year-old cyclo-cross World Champion imploded spectacularly with just under a lap to go, Van der Poel sinking like a stone in one of the many deep puddles flooding the Yorkshire roads.
Horrific conditions in the north of England forced the organisers to scrap two early climbs and shorten the course, with the extensive list of riders failing to go the distance including the defending champion Alejandro Valverde of Spain and the 2012 champion Philippe Gilbert or Belgium.
Mads Pedersen celebrates
Image credit: Getty Images
Yorkshire 2019 men's road race - how it happened
Severe weather saw the initial 285km course shortened by 23.5km to 261km after flooding ruled out the climbs of Buttertubs and Grinton Moor, an extra two laps of the Harrogate circuit added to the end to help even things out.
An early break of 11 riders defied the rain to edge clear of the pack - and what a break it was, featuring as it did three Grand Tour winners in Nairo Quintana (Colombia), Richard Carapaz (Ecuador) and Primoz Roglic (Slovenia).
Joining Roglic, the recent Vuelta winner, was his countryman Jan Polanc, while Magnus Cort (Denmark), Petr Vakoc (Czech Republic), Silvan Dillier (Switzerland), Maciej Bodnar (Poland), Jonas Koch (Germany), Hugo Houle (Canada) and Alex Howes (USA) completed the move.
The weather was enough to inundate Battersea Dogs & Cats Home with a fresh intake a few times over, adding a certain veracity to the expression ‘It’s grim up North’.
Despite the conditions, the break managed to establish a maximum lead of four-and-a-half minutes as they tackled the only major climb of the day, at Cray, before wading through a deep puddle on the summit.
Behind, it was the Australian, Dutch and French teams who did most of the chasing, with Rohan Dennis, Jos van Emden and Julien Bernard respectively putting in big shifts to keep the break in check as the race headed towards Harrogate and the start of the nine laps.
With around 125km remaining, there was heartbreak for Belgium’s Gilbert, the 2012 champion, who crashed on the entry to the circuit on Parliament Street. Gilbert’s compatriot Remco Evenepoel stopped to help pace back his trade teammate - but both riders failed to rejoin the fold and duly withdrew.
The break was soon swept up following the withdrawal of Roglic, who joined Ireland’s Dan Martin and a raft or riders to call it a day in the atrocious conditions.
With six laps remaining there were around 90 riders left, with defending champion Valverde joining the list of abandons - the Spanish veteran later describing the race as "a Worlds for madmen".
Ireland’s Sam Bennett - like Gilbert, a double stage winner from the Vuelta - was dropped on the Oak Beck climb with 75km remaining as Italy’s Giovanni Visconti kept the pace high. Britain’s Geraint Thomas and Kazakhstan’s Alexey Lutsenko soon followed suit.
The first move on the finish circuit came with 67km to go when American Lawson Craddock rode clear, swiftly joined by the Swiss powerhouse Kung. The duo soon established a lead of 30 seconds over the pack, which was gradually being whittled down over each of the demanding laps.
Denmark’s Pedersen joined Kung on the front as Craddock dropped back - and then abandoned - with three laps remaining.
Dutchman Mike Teunissen and, a bit later on, Italy’s Moscon entered the fray, making a quartet out ahead after Teunissen faded on the climb of Oak Beck.
An attack from Germany’s Nils Politt from the pack sparked some activity behind, with Belgium - by now down to five riders following the withdrawals of Gilbert, Evenepoel and Tim Declercq - burning a match with Dylan Teuns.
But after the dust began to settle on the flurry of activity, the Belgians - along with the French team of Julian Alaphilippe - found themselves without any presentation up the road.
Both teams had also been caught napping by the Dutch after Van der Poel sniffed out the danger and zipped clear with Trentin and Colombia’s Dani Martinez with 34km remaining.
Martinez could not keep up but Van der Poel and Trentin soon joined Moscon, Pedersen and Kung, with Spain’s Gorka Izagirre, Colombia’s Carlos Betancur and Latvia’s Toms Skujins in pursuit.
With the gap around 25 seconds back to the peloton with two laps to go, there was a whiff of danger in the air - especially with someone of the calibre of Van der Poel in the move.
Yves Lampart led the chase for the Belgians but the gap grew to 48 seconds for the quintet as the bell sounded for the final lap, with the chasing trio soon reabsorbed by the slimming pack.
Given his recent performances in his winning turn in the Tour of Britain, 24-year-old Van der Poel looked poised to inherit the World title his father Adri won in 1996 - until the moment he imploded dramatically.
On an uphill grind with 12.7km remaining, Van der Poel lost the wheel and then faded into oblivion, leaving four men ahead vying for three medals.
With two Italians in the mix, it looked like the umbrella-brandishing fans would see a similar result to the last time the World Championships came to England - when Beppe Saronni won at Goodwood in 1982.
Even when Moscon was dropped on the Oak Beck climb with 6km remaining, Trentin, who was fourth in the Bergen Worlds in 2017, looked to be the clear favourite.
Behind, Politt had upped the tempo for his German teammate John Degenkolb ahead of a move by Sagan with 4km remaining. But it was clearly too little, too late.
The leading trio hit the final rise of Parliament Street with an unassailable lead - with just the small matter of the colour of their medals to decide.
With Kung spent, it was always going to be a battle between Trentin and Pedersen. The Italian opened it up with 200m remaining but faded in the closing moments to allow his younger rival through to cap an extraordinary performance for the Danish team, who had Michael Valgren finish sixth and Jakob Fuglsang twelfth.
Mads Pedersen: It was 'survive, survive, survive!'
"Unbelievable," Pedersen said after the biggest win of his career - six years after he finished second behind Van der Poel in the Junior World Championships road race.
I didn't expect this when I started this morning. The plan was to get me out early so that Valgren and Fuglsang could come through in the final. But they didn't follow Van der Poel so I had my chance. It's every rider's dream to wear the rainbow jersey.
Trentin settled for silver and Kung bronze before Moscon came home in fourth place - one better than his performance last year at Innsbruck.
The best placed Belgian was Greg van Avermaet in eighth while France's Alaphilippe could only take 28th place - two spots behind Britain's highest finisher, Tao Geoghegan Hart.
As for the stricken Van der Poel, the Dutch livewire ended up in 43rd place after crossing the line almost 11 minutes in arrears - his golden dreams washed away like so much else in Yorkshire.
Such were the conditions that only 46 riders from the field of 197 completed the race, with the Czech Rebublic’s Petr Vakoc bringing up the rear, 19’25” down on the new man in rainbow stripes.