Dani Pedrosa took his first pole position of the year during an exciting qualifying session for the French MotoGP at Le Mans.
After three dry practice sessions led by Casey Stoner, rain fell prior to Moto3 qualifying, causing a drying track for the premier-class session.
Constant position changes on the ever-quicker track surface resulted in eight different riders occupying provisional pole during the hour, with the tyre transition from wets to slicks taking place just before the halfway stage.
Monster Yamaha Tech 3's Andrea Dovizioso held pole heading into the final six minutes, when Stoner edged ahead.
Team-mate Pedrosa then delivered his pole position lap with two-minutes to go, just before Alvaro Bautista fell and spots of rain returned - circumstances that kept Pedrosa on pole and ensured a first Yamaha front row for Dovizioso.
Dovizioso watched the closing minutes from the pits.
Stoner and title rival Jorge Lorenzo (fourth on the grid) were among those left visibly disappointed at the end of the unpredictable session.
Stoner, who leads the standings by one point from Lorenzo, announced on Thursday that he will retire at the end of the season.
Joining Lorenzo on row two of Sunday's grid will be fellow Yamaha riders Cal Crutchlow and Ben Spies, with Valentino Rossi qualifying as the top Ducati in seventh place.
Rossi will start alongside Gresini Honda's Bautista and Pramac Ducati's Hector Barbera.
Fellow Desmosedici riders Karel Abraham and Nicky Hayden were left tenth and eleventh. Hayden led the session twice, but plummeted down the order as lap times exceeded free practice pace at the end of the session.
Home star Randy de Puniet claiming twelfth place on his CRT Aprilia - ahead of the manufacturer bike of Stefan Bradl.
Rookie Bradl was one of he first to switch to slicks and led the session just before the halfway mark, but suffered a nasty highside from his LCR Honda soon after.
1. Dani Pedrosa
2. Casey Stoner
3. Andrea Dovizioso
4. Jorge Lorenzo
5. Cal Crutchlow
6. Ben Spies
7. Valentino Rossi
8. Alvaro Bautista
9. Hector Barbera
10. Karel Abraham
11. Nicky Hayden
12. Randy De Puniet
13. Stefan Bradl
14. Michele Pirro
15. Yonny Hernandez
16. James Ellison
17. Aleix Espargaro
18. Danilo Petrucci
19. Ivan Silva
20. Mattia Pasini
21. Chris Vermeulen