Juan Valera struck in the third minute of injury time to give Racing Santander a dramatic late win at fellow stragglers Osasuna and lift the Cantabrian side out of the relegation zone on Sunday afternoon.
Racing had looked unlikely to score all afternoon, even after Osasuna's Czech Republic midfielder Jaroslav Plasil had been sent off after 38 minutes for handling in the area.
Ezequiel Garay missed the resulting spot-kick and Racing failed to make their numerical advantage count in a low-quality second half.
But just as it looked as if Osasuna had done enough to hold on for what would have been a valuable point given the circumstances, Valera popped up with the winner after 92 minutes.
Racing came into this match on the back of three straight defeats and Osasuna had failed to score since the second game of the season.
It therefore hardly promised to be a classic encounter, and chances were at a premium early on.
Racing won a couple of corners in the first 20 minutes and came close to taking the lead following the second of those, when Osasuna defender Cesar Azpilicueta hacked the ball off his goal-line.
That seemed to liven up proceedings and Osasuna almost scored from a corner of their own three minutes later when Miguel Flano struck the post with a crashing header.
But Osasuna suffered a huge double blow seven minutes before the break, when Plasil was shown a straight red for handling a Racing free-kick in the area and the referee awarded a penalty to the visitors.
Plasil, who had been in a defensive wall, protested his innocence but left the field amid jeers from the home fans.
Luckily for him and Osasuna, Garay saw his penalty saved by Ricardo and the keeper also gathered the defender's header on the rebound to keep his side level.
Going a goal down would have been harsh on the home side, who had looked marginally the better team up until now.
And the Pamplona-based club continued to hold their own in the second half, despite playing with a man down.
They could even have gone ahead after an hour, but Iran midfielder Masoud Shojaei was unable to get any real power behind his shot and Tono saved comfortably.
Tono also did well to save Ludovic Delporte's header as Jose Angel Ziganda's men continued to look the more likely to break the deadlock.
But as the minutes went by, Osasuna's 10 men began to tire and Racing saw more of the ball in the closing stages.
Nevertheless, it looked as if the hosts had done enough to hold on until Valera rose to head home a cruel late winner in the third minute of added time.
It was harsh on Osasuna, who are now above the drop zone on goal difference alone.
Thanks to their dramatic win, Racing lie in 14th place after six matches with five points, one more than Osasuna.