Stefan Bradl claimed a shock MotoGP pole at Laguna Seca after Marc Marquez blew his chances with a crash.
Marquez had looked set to dominate qualifying, having been quickest in practicesessions two, three and four, and with main rivals Jorge Lorenzo and Dani Pedrosa nursing injuries.
Championship leader Marquez duly commenced Q2 with two laps half a second clear of the pack.
But while trying to improve further, he slid into a low-side crash at Turn 6.
Until the final minute, it appeared that Marquez's 1m21.193s might still hold for pole.
That was until Bradl launched his LCR Honda to the top with a lap 0.017 seconds faster than the man he beat to the 2011 Moto2 title, giving the German his first ever MotoGP pole.
It was an all-Honda front row, with Alvaro Bautista's thrid place for Gresini almost as big a surprise as Bradl's pole given the Spaniard's recent difficulties.
Valentino Rossi was the fastest Yamaha in fourth.
Cal Crutchlow had a troubled session, crashing in practice four just before qualifying then losing half of Q2 to a sensor problem on his Tech 3 Yamaha.
The Briton salvaged fifth with one of the few flying laps he managed.
Lorenzo challenged for a front row spot despite his injuries, but ultimately had to settle for sixth.
That was just one place ahead of Pedrosa, who made short work of getting through Q1 to the pole shootout having sat out practice one and three to avoid straining his damaged shoulder.
Andrea Dovizioso was top Ducati in eighth, followed by Bradley Smith, Nicky Hayden and CRT pacesetter Aleix Espargaro.
The latter's Aspar team-mate Randy de Puniet reached Q2 but crashed at Turn 3 before he could set a time.
Pramac's stand-in rider Alex de Angelis will start 14th for his MotoGP comeback.
Only 23 bikes will contest the race as American wildcard Blake Young and his Attack team had to withdraw following Young's destructive crash on Friday afternoon.
Pos Rider Team/Bike Time Gap
1. Stefan Bradl LCR Honda 1m21.176s
2. Marc Marquez Honda 1m21.193s +0.017s
3. Alvaro Bautista Gresini Honda 1m21.373s +0.197s
4. Valentino Rossi Yamaha 1m21.418s +0.242s
5. Cal Crutchlow Tech 3 Yamaha 1m21.420s +0.244s
6. Jorge Lorenzo Yamaha 1m21.453s +0.277s
7. Dani Pedrosa Honda 1m21.728s +0.552s
8. Andrea Dovizioso Ducati 1m22.026s +0.850s
9. Bradley Smith Tech 3 Yamaha 1m22.075s +0.899s
10. Nicky Hayden Ducati 1m22.090s +0.914s
11. Aleix Espargaro Aspar Aprilia 1m22.099s +0.923s
12. Randy de Puniet Aspar Aprilia
13. Hector Barbera Avintia FTR-Kawasaki 1m22.808s Q1
14. Alex de Angelis Pramac Ducati 1m23.253s Q1
15. Colin Edwards Forward FTR-Kawasaki 1m23.272s Q1
16. Danilo Petrucci Ioda-Suter-BMW 1m23.323s Q1
17. Claudio Corti Forward FTR-Kawasaki 1m23.616s Q1
18. Yonny Hernandez PBM Aprilia 1m23.875s Q1
19. Karel Abraham Cardion Aprilia 1m23.919s Q1
20. Michael Laverty PBM-Aprilia 1m23.987s Q1
21. Hiroshi Aoyama Avintia FTR-Kawasaki 1m24.235s Q1
22. Bryan Staring Gresini FTR-Honda 1m24.756s Q1
23. Lukas Pesek Ioda-Suter-BMW 1m24.809s Q1