Gonzalo Higuain scored an 88th-minute winner as Real Madrid came from a goal down to sneak past a gutsy Deportivo La Coruna side, 2-1 on Saturday.
The hosts, bottom of La Liga, took the attack to a slightly weakened Madrid side, with Luis Pizzi and Riki causing no amount of problems and it was the latter who broke the deadlock 10 minutes before the interval.
Depor had several chances to extend its lead but was made to rue some poor finishing when Kaka equalized in the 73rd minute, while Higuain sealed victory for the visitors two minutes from time.
Angel Di Maria was then given his marching orders in the 90th minute after picking up two bookings, but it mattered little to the result.
Jose Mourinho took the opportunity to rest several first-team stars ahead of Tuesday's Copa del Rey clash with Barcelona, while a Champions League last-16 second leg at Manchester United is looming large on the horizon.
The most notable absentee was Cristiano Ronaldo, who cut an imposing figure from the bench but could only watch on as his side was outplayed in the first half by the side coming into the game at the foot of the table.
Deportivo came out all guns blazing and Madrid goalkeeper Diego Lopez looked rather shaky, spilling Riki's fierce effort before defender Pepe cleared the danger.
Mourinho's men were lacking a cutting edge up front but the hosts looked vibrant and Pizzi narrowly missed the target, having cut in from the right.
But Depor would break the deadlock in the 35th minute when Riki latched on to Pizzi's pass, cut in-between defensive duo Ricardo Carvalho and Pepe before beating Lopez at his near post.
Any thoughts the hosts would sit back and try to protect their lead were dismissed when Pizzi cut past Pepe before curling over Lopez only for full back Marcelo to spare his team's blushes and head off the line.
Riki then twisted and turned past Carvalho, with his shot narrowly missing Lopez's right hand post while Madrid's goalkeeper also had to deny Portuguese winger Bruno Gama's fizzing strike before the interval.
Madrid was in all likelihood grateful for the half-time whistle to stop the Depor onslaught and emerged energized when it came back out, with Callejon heading wide and Marcelo's goalbound strike blocked in the box.
Perhaps sensing an opening, Mourinho made a triple substitution as Ronaldo, Mesut Ozil and Sami Khedira entered the fray.
Madrid's star player made an immediate impact, slotting through for Higuain who thought he had drawn his side level when he netted, but the Argentinian had been flagged offside.
The visitors were certainly on top, however, and deservedly leveled matters when Kaka fired low into the net from just outside the area in the 73rd minute.
With the bit between its teeth, Madrid went in search of a winner and Ronaldo leapt in front of his marker but could only head narrowly wide.
But the Portugal international would play a key role to help his side snatch victory in the 88th minute, collecting the ball from Kaka and squaring for Higuain, who was left with the simplest of tap-ins.
Madrid's night was slightly soured by Di Maria's sending off in the final minute, the winger perhaps harshly given his second booking for not advancing 10 yards at a set piece.
Real Zaragoza missed a great chance to increase the gap between it and the sides in the relegation zone by throwing away a two-goal lead to draw 2-2 with Valencia.
A penalty by Apono and a headed goal by Helder Postiga gave the Aragon side a two-goal cushion that was canceled out by a double from Jonas.
However, things could have been even worse for Manolo Jimenez's side, who played the final 11 minutes of the game with 10 men after goalkeeper Leo Franco was sent off for handling the ball outside his area.
Elsewhere, Getafe came from a goal behind to claim a 3-1 win over Real Mallorca at the Iberostar stadium thanks to scoring three times toward the end of the second half.
Giovani Dos Santos gave the hosts the lead midway through the first half but everything changed when Getafe was awarded a controversial penalty with 20 minutes remaining.
Diego Castro scored from the spot to equalize and then Adrian Colunga netted twice inside five minutes to condemn Gregorio Manzano's side to back-to-back defeats.