Tino Costa headed an injury time winner for Valencia to win 3-2 at Deportivo La Coruna on Saturday, the hosts finishing the game with nine men to remain bottom of the league.
Valencia move into fifth and level on 33 points with city neighbours Levante, but both can be surpassed by Rayo Vallecano and Malaga, who are in action on Sunday.
Deportivo stay rock bottom of La Liga, now four points from safety, and will have to improve if they are to avoid the drop.
They began very nervously when Jonas Goncalves headed home a near post corner to put Valencia ahead after only 32 seconds.
Depor then survived an early Valencia onslaught and Costa, Pablo Piatti, Jonas and Nelson Valdez on two occasions could have extended the lead before Riki struck twice to give his side an unexpected lead at the interval.
The equaliser came on 32 minutes with a header from a Pizzi free-kick before he broke on the counter-attack and hit a left-footed drive on the stroke of half-time to make it 2-1.
Riki now has eight for the season but his team has the worst defensive record in the league and they were not helped on 52 minutes when Silvio, a recent loan signing from Atletico Madrid, received his marching orders for a second yellow card.
Seven minutes later Valdez made up for his earlier misses by turning home a Juan Bernat cross but he later saw a volley brilliantly save by Dani Aranzubia in the Depor goal that appeared to have earned a vital point.
Then Costa popped up in injury time with the winner and Depor's Paulo Assuncao made it worse when he left his side to finish the game with nine after an elbow on Valdez.
Levante had earlier come from behind to grab a last minute winner and beat Valladolid 2-1.
Javier Baraja had put the visitors ahead on eight minutes with a drive from the edge of the area before Jose Barkero floated home a free-kick just before half-time to level the game.
The second half was an even affair but Levante kept pushing for a winner that fortuitously came in the last minute when Obafemi Martins miscontrolled a pass from substitute Valdo into the path of the oncoming defender Antonio Rukavina, who turned the ball into his own net.
For Levante the win ended a run of two straight defeats, Valladolid remain in tenth on 28 points.
Ahead of them on 30 is Real Sociedad who drew 1-1 at Celta Vigo.
Danish international Michael Krohn-Dehli gave the home side a half-time lead but their hopes of a much needed win were dashed when Augusto Fernandez was sent-off for a second yellow card on 50 minutes.
From that point Sociedad always looked likely to get something and when Gorka Elustondo headed home a corner nine minutes later they were favourites for the win.
Celta however held on for the point that keeps them two points clear of the relegation zone.
Zaragoza and Espanyol played out a goalless draw that leaves both in the bottom-half of the table.
Both sides lost a player to two yellow cards late on, Javier Lopez for Zaragoza and Cristian Sapunaru for the visitors for who Christian Stuani had the best chance of the game when he saw a header well saved by Roberto Jimenez in the Zaragoza goal.
On Sunday, league leaders Barcelona entertain Osasuna while second placed Atletico, eight points behind, go to Athletic Bilbao.
Real Madrid, a further seven points back back in third position, have a home derby with Getafe.