Bagnaia – denied a maiden MotoGP™ pole and another Misano lap record in qualifying for exceeding track limits – looked set to clinch his maiden success as Sunday's grand prix entered its final stages.
Yet there was to be heartbreak for the Italian, who held over a 1.2-second advantage when he skidded off the track with seven laps remaining.
Vinales, who had started on pole for the second successive race after missing a golden opportunity in the first of the back-to-back Misano rounds last time out, took full advantage to claim his first win of the season and propel himself up the championship standings.
Quartaro crossed the line in third, but a long-lap penalty cost the Frenchman top spot in the championship standings, who was handed a three-second post-race punishment, with Espargaro taking the final spot on the podium.
Last weekend's winner and Quartararo's fellow Petronas Yamaha rider Franco Morbidelli came in ninth, one place behind championship leader Andrea Dovizioso (Ducati), who now only holds a one-point advantage over Quartararo and Vinales.
- Maverick Vinales (Monster Energy Yamaha)
- Joan Mir (Suzuki Ecstar) +2.425s
- Pol Espargaro (Red Bull KTM Factory Racing) +4.528
- Fabio Quartararo (Petronas Yamaha) +6.419 (after three-second penalty)
- Miguel Oliveira (Red Bull KTM Factory Racing) +7.368s
- Takaaki Nakagami (LCR Honda Idemitsu) +11.139s
- Alex Marquez (Repsol Honda) +11.929s
- Andrea Dovizioso (Ducati) +13.113s
- Franco Morbidelli (Petronas Yamaha) +15.880s
- Danilo Petrucci (Ducati) +17.682s
- Andrea Dovizioso (Ducati) 84
- Fabio Quartararo (Petronas Yamaha) 83
- Maverick Vinales (Monster Energy Yamaha) 83
- Joan Mir (Suzuki Ecstar) 80
- Franco Morbidelli (Petronas Yamaha) 64
- Petronas Yamaha 147
- Monster Energy Yamaha 141
- Suzuki Ecstar 124
- Ducati 115
- Red Bull KTM Factory Racing 110
After two successive races at Misano the teams will head for Barcelona, for the Catalan GP, 25-27 September.