Lithuania's Danas Rapsys beat the Olympic champion to the wall in a pulsating final, only to see the dreaded "DQ" flash up on the giant screen for having twitched on the starting blocks.
Briton Duncan Scott, who tied for the bronze medal, refused to shake Sun's hand on the podium - as Australian Mack Horton had after losing to the Chinese giant in the weekend's 400m final.
Sun is competing under a doping cloud after a leaked FINA report alleged that he smashed blood samples with a hammer after being visited by testers last year.
Scott also declined to step up to the top step for official photos, prompting a furious Sun to bark at him "You lose, I win!" as they walked downstairs for their lap of honour.
The European champion then marched away from the pool deck, leaving Sun and the other medallists to pose for more photographs, triggering loud jeers from Chinese fans.
Scott blanked waiting journalists but fellow Briton Adam Peaty backed his team-mate.
"He's completely right," said Peaty after qualifying fastest for Wednesday's 50m breaststroke final.
"(Sun) should be asking himself whether he should really be in the sport," he added.
"I wouldn't have gone on the podium. The most important thing as a sportsperson is you have the right to a voice and Duncan showed his voice."
Sun, branded a "drug cheat" by Horton at the 2016 Rio Olympics over a previous three-month ban for taking a stimulant he maintains was for a heart condition, pumped his fists and let out a throaty roar after being gifted an 11th world title.
Greeted like a rock star by a noisy section of adoring female fans, Sun clocked one minute, 44.93 with Japan's Katsuhiro Matsumoto (1:45.22) pocketing silver as Scott and Russia's Martin Malyutin (1:45.63) shared the bronze.
"That my be my luckiest ever gold medal," said Sun after his sixth race of the week.
"But fortune rewards those who work hard and I've been working so hard for this."
South African Chad le Clos, runner-up to Sun in the 200m free at the Olympics, said: "It's good that people are taking a stand - I want my gold medal back from Rio and (fourth-placed) James Guy should get his bronze, because it shouldn't be allowed to have people cheating in sport."
American Lilly King, who let rip at Sun and FINA doping controls earlier this week, beat Russian rival Yulia Efimova - another former convicted doper - to retain her women's 100m breaststroke crown in 1:04.93.
Elsewhere, Italy's Simona Quadarella snaffled gold in the women's 1,500m free in a final missing American great Katie Ledecky, who pulled out of her title defence after feeling unwell.
"I can't stop crying," sobbed the 2017 bronze medallist after going 15:40.89 to claim an unexpected upgrade.
Canada's Kylie Masse claimed her second successive women's 100m backstroke title in 58.60 while China's Xu Jiayu matched her by retaining his men's 100m backstroke crown with a time of 52.43.