A second string Deportivo Coruna side dealt a severe blow to Real Madrid's title chances when they beat the champions 2-0 at the Riazor on Saturday.
A precise shot from striker Diego Tristan and a scorching free kick from defender Joan Capdevila secured Depor a morale boosting win ahead of their Champions League semi-final, second leg against Porto on Tuesday.
Real's misery was compounded by the sending off of influential midfielder Zinedine Zidane just before the break after he picked up a second booking for a pointless foul on Brazilian midfielder Djalminha.
The result means that with just three games to play Real remain in second place in the Spanish Primera Liga, a point behind leaders Valencia, who have a game in hand and host Real Betis on Sunday.
Valencia top the table on 71 points, Real have 70, third-placed Barcelona have 66 and Deportivo 65.
If Barcelona win their game against city rivals Espanyol on Sunday they will close to within one point of arch-rivals Real.
Knowing that a win would give them the overnight leadership and put pressure on Valencia, Real made an aggressive start against Depor, who were fielding a shadow side ahead of the Porto game.
Real's Luis Figo, given the all-clear to play despite being sent off in last week's 2-1 loss to Barcelona, swept in a dangerous cross from the right and fellow midfielder Esteban Cambiasso hit the post with an improvised volley after seven minutes.
The Portuguese international then set up Michel Salgado for a chance as he cut inside from the wing, but the Real right back fired the ball narrowly over the bar from the edge of the area.
Real began to flag, however, as the half wore on and Deportivo took full advantage by scoring in practically their first attack on 29 minutes.
Real keeper Iker Casillas blocked a low shot from Sergio after Djalminha had launched a rapid break and Diego Tristan was on hand to snap in the rebound with a precise strike.
Real were flustered by the setback and Zidane, Michel Salgado and David Beckham all picked up unnecessary bookings in the next few minutes.
Ronaldo, making his return to the side after three weeks out with a thigh injury, came close to settling his side's nerves when he beat the Depor defence for pace and cracked a fine shot onto the base of the post.
Zidane was dismissed for his rash challenge on Djalminha in the middle of the park four minutes from the break.
Real's run of bad luck continued two minutes later when skipper Raul hit the bar with a fine dipping shot from the edge of the box.
Coach Carlos Queiroz substituted Beckham on the hour and brought on Argentine midfielder Santiago Solari in his place to the England captain's obvious anger, but the decision failed to produce the desired result.
Although Real continued their assault on the Depor area it was the home side who gave a devastating lesson in finishing after they won a free kick some 30 metres out in the 68th minute.
Capdevila stepped up and fired his wickedly swerving free kick wide of the diving Casillas and inside the post to secure the victory and deal Real a second successive defeat.
Earlier Atletico Madrid moved up into sixth position and renewed their bid for a place in next season's UEFA Cup with a breathless 3-2 victory at home to relegation-threatened Celta Vigo.
Celta remain in deep trouble in 19th place, a point behind Espanyol and Valladolid who had yet to play this weekend.