Marcos Ruben put the away side in front after 19 minutes thanks to his powerful header.
The striker could have doubled his side's lead from the penalty spot just before the hour when goalkeeper Jose Arribas had committed a foul. However, Ruben was wayward with his kick as the score remained 1-0.
The Argentine cancelled out his earlier miss with five minutes left when he played in Angel Lopez, who fired home to seal the win.
Sixteenth-placed Villarreal are now six points clear of the drop zone, while Vallecano stay 11th.