The rain came to the rescue for Lewis Hamilton, just as it had in Germany a week ago.
In the dry, Hamilton's title rival Sebastian Vettel looked a certain bet for pole in a Ferrari that was perfectly poised and balanced, while Hamilton's Mercedes was skittish and nervous, so much so that both he and team-mate Valtteri Bottas spun in final practice.
But a wet track levelled the playing field and Hamilton, as he so often does, excelled.
His pole lap was 0.26secs quicker than Bottas, and 0.812secs fast than Vettel, who starts fourth, having qualified just 0.024secs slower than team-mate Kimi Raikkonen.
"The rain was a blessing," Hamilton said. "I had no idea I would be shooting for the front row and pole. I couldn't be happier. It is quite a shock, really. I was not expecting to be here."
It sets up an enticing race. If it is dry, as expected, the two slower front-running cars are starting in front of the two faster ones, and Vettel really needs to make the most of a circuit that should have been a slam-dunk win to cut Hamilton's championship lead.
- Hamilton takes superb pole in wet conditions
- Chequered Flag podcast: 'Mercedes rip up the script'
- How the qualifying hour unfolded
Right now, that stands at 17 points, but if Hamilton wins on Sunday, it will go out to nearly a clear win. There are still nine races to go after Hungary, and some will definitely favour Ferrari, but that sort of margin is a significant psychological hurdle even if it is not a huge mathematical one.
Both Hamilton and Bottas indicated they expect to fight something of a rear-guard battle in the race. In their favour is that overtaking is harder at Hungary than perhaps anywhere other than Monaco.
"It will mean it is quite a close race," Hamilton said. "It is going to be close. It is going to be hard to keep the tyre temperatures under control. I cannot tell you what is going to happen; we just have to get our heads down and try to pull away."
Bottas added that simulation runs in Friday practice suggested Mercedes were slower than both Ferrari and Red Bull on race pace.
"From our numbers, we were the third-quickest team on the long runs," Bottas said, "so I think we really need to get everything perfect from the race start.
"It's going to be really hot, a really long race, so… yeah, overtaking is difficult but there's many opportunities for the cars behind to get us if they have more speed. So we really need to be on it."
Where did Ferrari's pace go?
Vettel looked imperious throughout practice and had been very confident of pole had it remained dry and hot.
"In the dry, we were pretty much in control. But the race is long, so we see what we can do," he said. "We are starting fourth so we focus on winning from fourth."
For the most part the qualifying hour was anything but dry, and Ferrari's pace bled away.
Vettel topped the first and second segments, but the first ended on a drying track, and in the second Ferrari pulled a strategic masterstroke - or got lucky, depending on your point of view - by sending Vettel out on intermediates straight away.
Everyone else went out on slicks only to find a soaking track in the final sector, and need to pit immediately.
That meant Vettel got the best of the conditions, and he topped the session by two seconds from Renault's Carlos Sainz, who was highly impressive throughout and ended up fifth on the grid.
In the top-10 shootout, though, the conditions were bad enough for full-wet tyres and Hamilton and Bottas were in control.
- Predict the top three at the Hungaroring
- Hungarian GP - qualifying results
- How to follow the Hungarian GP on the BBC
On the face of it, this does not make sense. The Ferrari's pace on this track comes from it having greater downforce in a high-downforce configuration - which is why it was quicker than the Mercedes in Monaco, and is expected to be again in Singapore in September.
More downforce should also help in the wet, and yet suddenly the Ferraris were slower. Why would that be, this writer asked Vettel afterwards?
"It is not always that straightforward," he said. "I see where you are coming from. Obviously we did not have much running in the wet so far this year and the little bit we have, we have some work still to do.
"It wasn't awful. It is not a disaster to start third and fourth, but we certainly want to be ahead. In the dry, it could have been a different outcome, but it wasn't dry. And we need to make sure also in the wet we are there."
A pause. "Sorry, I can't really answer."
Because you don't know?
"Well, I think I know, but…"
Mercedes F1 boss Toto Wolff believes the answer is a mundane one - tyre temperature in wet conditions. Mercedes had their tyres just-so, and it seems Ferrari may not have done.
That certainly applied to Red Bull, whose driver Max Verstappen, normally outstanding in the wet, had tyre temperatures far lower than optimum and ended up down in seventh.
Of course, Hamilton's peerless wet-weather skills cannot be underestimated.
And Bottas was pretty good, too.
Force India problems could shake-up F1
This weekend has been dominated by the future of Force India, who were put into administration on Friday night following legal action from their driver Sergio Perez.
The Mexican told BBC Sport he took the decision to protect the future of the team, having been asked to do so by his bosses. He did not specify who, but it was almost certainly deputy team principal Bob Fernley and chief operating officer Otmar Szafnauer.
Putting the team into administration, Perez said, fended off a winding-up order from another creditor.
All parties involved sound confident that the move will help secure the future of a team that has been suffering in recent times because of the legal and financial difficulties of co-owner Vijay Mallya. He is fighting extradition to India on fraud charges, which he denies, and this has impacted the finances of the team.
There are said to be at least three potential buyers - two US consortiums and one from a Russian businessman - and the team's situation raises the potential of all sorts of changes up and down the field.
For a start, the drivers are now potentially free to move. Esteban Ocon is already on the way to Renault for 2019 - a move that is all but sorted but has not yet been officially confirmed.
But Force India's situation means it will either have new owners before long, or collapse, which means Ocon could potentially move to Renault this year.
This would mirror what happened last year, when the French car company was in negotiations with Red Bull and McLaren over the engine swaps between Honda and Renault, and Sainz ended up moving from Toro Rosso to Renault for the last few races of the season.
Sainz is in intense talks with McLaren for a drive next year. He would either partner his friend Fernando Alonso, who has yet to make a decision on his future, or replace him if the two-time champion decided to switch to Indycars.
With Force India as it is, it's not beyond the realms of possibility that Ocon could move into Sainz's Renault in the second half of this year, and Sainz move to McLaren to replace Stoffel Vandoorne.
The Belgian, who has been struggling to match Alonso this year, would then be a free agent, and he might be attractive to Toro Rosso, who have been looking to replace Brendon Hartley for some time, and had a bid for McLaren's reserve driver Lando Norris rejected back in June.
This could dovetail with the dispute between McLaren and Toro Rosso over the future of James Key.
As BBC Sport reported on Thursday, Key has resigned from his position as technical director of Toro Rosso and signed to do the same role at McLaren. But he has a contract with Toro Rosso that the team describe as "long-term" - believed to be until 2020 - and when he can join McLaren will be the subject of negotiations.
So far Red Bull motorsport advisor Helmut Marko is playing hardball and doing his negotiations in public, saying he will hold Key to his contract. He even told BBC Sport on Saturday that Key had not resigned, which sources say is not an accurate representation of events.
In any case, employment law dictates that Red Bull cannot prevent Key from moving to McLaren for longer than 12 months, and McLaren clearly want him before that. Perhaps a deal involving Vandoorne and/or Norris could smooth the way for that to happen earlier.
Meanwhile, Lawrence Stroll, the father of Williams driver Lance, is said to be keen to move his son to Force India, and has been seen having talks with Szafnauer.
Again, that was for 2019, but perhaps it, too, could happen earlier, with Mercedes junior George Russell, who is impressing in Formula Two, moving to Williams to replace him.
It's early days in all this, and it might in the end take until next year for all this to happen. Or it might be sooner. Certainly, following the developments at Force India, it could be.
The summer break, with nearly four weeks between Hungary and the next race in Belgium, promises to be very busy for some of F1's most influential figures.