Lowly Girona stunned Real Madrid as they came from a goal down to win 2-1 at the Bernabeu on Sunday in a game that saw Sergio Ramos sent off for two bookings.
But there's relief for Madrid, as Ramos will be suspended for next week's game at Levante rather than the two upcoming Clasico games.
Casemiro gave Madrid a half-time lead, but Cristhian Stuani levelled from the penalty spot and Cristian Portu headed home a shock winner for the side that began the day in 17th place.
Girona made a positive start, putting together a neat move when Portu and Alex Granell linked but the final ball into the Madrid area just failed to find Stuani.
Madrid flickered into life, Toni Kroos serving a warning sign when his dangerous free kick was cleared by Douglas Luiz.
And Kroos was again involved as Madrid took the lead after 25 minutes, his cross headed powerfully home by Casemiro.
Lucas and Alvaro Odriozola combined to look for Karim Benzema, who was unable to reach a low cross, before Alex Granell smashed an effort wide for Girona.
Benzema was close to doubling Madrid's lead as half-time approached, Bounou saving his rising shot, and he should have done so early in the second half only to head Marco Asensio's cross wide when unmarked inside the six-yard box.
Madrid coach Santiago Solari made his first change just before the hour, bringing Vinicius Jr. on for Lucas shortly before the hour, but soon afterwards his side were thankful for a bad Girona miss.
The visitors looked certain to equalise when Courtois saved from Anthony Lozano but Aleix Garcia, from close range, somehow lifted the ball over the top.
But they were level after 64 minutes when Ramos handled a Garcia shot and Stuani beat Courtois from the penalty spot, Ramos going into the book.
Vinicius Jr. shot over as Madrid looked to regain their advantage, but things almost got worse for the home side after 71 minutes when Girona's Portu smacked a shot against the post.
And they did get worse with a quarter of an hour remaining as the visitors went in front, Courtois parrying Lozano's shot and Portu diving to head the rebound past him.
Vinicius Jr. saw a curler go wide of the far post as time began to run out for Madrid, substitute Gareth Bale then thwarted by Bounou.
In the closing moments, a high boot from Ramos deep inside the Girona penalty area brought a second yellow and his 25th red card for Madrid and there was still time for keeper Courtois, up for a corner, to head narrowly wide.