Casey Stoner will start Sunday's German MotoGP from the front of the grid after claiming his fourth pole of the season - with his spare bike - at a soaking Sachsenring.
The reigning world champion had been forced to park his number one RC213V after technical troubles hallway through the hour and by the time he had returned to the pits the rain had intensified.
Returning for the final ten minutes, Stoner won his 38th MotoGP pole after a thrilling final lap showdown with team-mate Dani Pedrosa, Yamaha's Ben Spies and Tech 3's Cal Crutchlow.
“We started with the bike that I ended up finishing on,” confirmed Stoner. “We weren't too happy with the set-up, we were still struggling a lot for rear grip, rear feeling.
“So we went on to my number one bike with a completely different set-up and immediately it was better. I matched my best lap time on the first lap. The next lap was going to be a lot better, but unfortunately the engine just switched off.
“Not all the electronics, just the engine. We're not too sure if some water got in something and created it.
“By the time I got back to the garage and put the tyres back on my second bike it had started to rain really heavily. I said to my chief mechanic 'we'll wait until the last ten minutes and then see what we can do'.
“I went out, tried to warm the tyres and put some laps times down as the track was drying. We timed it well enough and got pole position right at the end there. We're happy.
“After a difficult session it was nice to come out on top and we'll see what we're capable of tomorrow.”
Stoner will start Sunday's race, the eight round of the season, equal on points with Yamaha's Jorge Lorenzo, who qualified in fifth.