Valentino Rossi stole the Aragon MotoGP qualifying headlines on Saturday by securing a front row seat on the grid a mere three weeks after double leg fracture surgery.
The wounded nine-time champion, wearing a surgical stocking, defied medical experts and gritted his teeth through the pain to post the third fastest time for Sunday's race behind his Yamaha teammate Maverick Vinales and Ducati's Jorge Lorenzo.
World champion Marc Marquez appeared set for pole only to crash on his Honda two minutes from the end of the session, having already taken a tumble in final practice.
The Spaniard starts on the second row in the company of Cal Crutchlow and Dani Pedrosa.
Seconds after Marquez's premature exit Rossi was topping the timesheets, only to be bettered as the session drew to a dramatic close by first Vinales with a 1min 47.635 lap and then Lorenzo at .100s.
Rossi, placed fourth in the world championship standings, broke his leg in two places in a training accident on August 31.
Operated on the following day his medical team had initially forecast a return for the next race in Japan.
But that was without counting on the 38-year-old veteran's remarkable resilience as he targets a tenth world title and eighth in the top category.
"It's a big surprise for me, one week ago I started to think I could race but I didn't know what to expect," a beaming Rossi, who had come in 20th in practice on Friday and improving to 10th on Saturday morning, told BT Sport.
"I was in quite a lot of pain in Misano (the Italian circuit where he tested his fitness on Tuesday), but luckily the leg has got better day by day, I can ride with a bit of pain."
"It's very important to start from the front row," added the motorcycling legend known as 'the doctor'.
Marquez will be cursing his late spill when his Honda slipped from under him in a downhill stretch with the bike on the edge of the track.
He won last weekend in San Marino to draw level with Andrea Dovizioso, who starts Sunday's race on the third row, on 199 points at the head of the standings, with Vinales in third on 183 and Rossi on 157.
After Sunday's race in Aragon the MotoGP season moves on to Japan before the closing three legs of the 2017 season in Australia, Malaysia and back in Spain for the finale in Valencia.