Nicky Hayden admitted he surprised himself by taking second on the grid at Sepang after struggling to even get into the top 10 in practice.
The Ducati rider had feared he was in for a repeat of his tough Japanese Grand Prix weekend when he was an off the pace 15th in Friday's session.
He was only 11th in the second practice hour this morning, but then burst through from nowhere to grab provisional pole with four minutes to go in qualifying.
Although championship leader Jorge Lorenzo managed to beat Hayden's time, he hung on for second - only his second front row start since joining Ducati, and his first pole since Estoril in 2007.
"It's a bit of a surprise, but I'd say it's more like a shock," said the delighted Hayden.
"I didn't expect to be so close to pole, one tenth off pole, but I'm not going to feel sorry for myself to miss out by that much because we got in a really good lap. I think we did the maximum, me and the bike."
Hayden said the breakthrough had been made this morning, even though the practice results had suggested he was still lacking speed.
"We made a good step today. We went back to a different set-up that we'd used in the test and even though this morning I didn't get the lap time, I had a good feeling, and I was just able to get a good lap in on the soft tyre and get on the front row," he said.
"Now we'll try and do something tomorrow, try and get a good result."