Rayo struck twice in the final 15 minutes through Diego Costa and Miguel Michu to snatch victory after Helder Postiga fired the hosts ahead on 33 minutes.
Vallecano's win moved them five points clear of the drop zone but their beleaguered hosts, now without a La Liga win in 14 games, are six points adrift at the bottom.
Zaragoza had looked like they might end their long wait for a league win when they controlled the opening half.
Postiga was their main threat and flashed a shot just over after 14 minutes.
The Portugal forward was on target after 33 minutes to give his side a rare lead. Antonio Apono floated in a cross from the right wing that Postiga volleyed in with his right boot.
Postiga had the chance to double his side's lead after 58 minutes but he just could not do it.
Luis Garcia provided the cross but Postiga directed his header wide of the target.
Rayo finally began to provide a threat in the final quarter of the game and Michu got a header to Triguero Tito's cross but home goalkeeper Roberto got a big old hold on it.
The away side were level soon after, however, thanks to a perfectly directed header from Costa.
Jose Manuel Casado crossed from the right and the striker leapt above the defence and deflected his header to the far post and just out of the reach of Roberto.
Zaragoza tried to recover their lead but Angel Lafita's effort was tipped wide by Robles Joel.
The match began to open up as both side's went in search of a winner that Rayo managed with eight minutes left.
After a counter-attack Jose Manuel Casado pulled the ball back to Michu, who found space at the top of the area, where he coolly picked his spot with a side-footed shot.