As the rain increased, so did Rossi and Dovizioso's lead, which topped 13 seconds over de Puniet by the halfway mark - but disaster struck for Rossi when the rear of his M1 span-out through the Fogarty Esses on lap 20, almost taking Dovizioso with him.
Rossi rejoined in eleventh, while Dovizioso found himself almost ten seconds clear of de Puniet and firmly on target for his first MotoGP victory. But it was far from an easy task; the rain was still increasing and the young Italian was now without Rossi to use as a guide for the available grip.
As the conditions got worse, Edwards got stronger and had climbed all the way up to third on lap 23, then took second from de Puniet with three laps to go. But the big news was that the pair had ripped Dovizioso's lead apart - with Edwards now less than one second behind the Repsol Honda rider!
But de Puniet wasn't settling for third and attacked Edwards straight back, and as the Tech 3 Yamaha and LCR Honda went back and forth Dovizioso was able to edge his advantage back up again.
The last lap began with Dovizioso 1.4sec ahead of de Puniet and Edwards, and Dovizioso remained wheel perfect to the flag for his first ever MotoGP victory, second podium and first race finish in four starts!
Meanwhile Edwards snatched second from de Puniet at the very final turn, as all three riders climbed the podium for the very first time this season.
Gresini Honda's Alex de Angelis
crept almost unseen up to fourth place, while Rossi snatched fifth place from home hero Toseland at the final turn, an initial attempt to pass the Englishman's Tech 3 Yamaha into the Fogarty Esses having been rebuffed. Toseland equalled his best MotoGP finish of the year, and his career so far.
The worsening weather had prompted several riders to swap bikes late in the race, with Hayate's Marco Melandri
the highest placed rider to do so in seventh. Rookie Niccolo Canepa
claimed a commendable eighth for Pramac Racing, as the top Ducati, while Pedrosa's apparent loss of confidence saw him slip back to ninth.
Tenth and eleventh went to Mika Kallio
(Pramac Ducati) and Loris Capirossi
(Suzuki), who also swapped bikes, while Gabor Talmacsi stuck it out on slicks for a MotoGP best of twelfth on his Scot Honda.
Chris Vermeulen (Rizla Suzuki) also changed to wets on his way to 13th in conditions that would normally have suited him, while Hayden and Stoner never recovered and remained a lap down. Their wet tyres finally lapped quicker than the slicks on lap 24, but it was way too late.