The Venezuelan international spent the 2012-13 season on loan at Celtic and was part of their championship winning squad. But he scored just two goals in 14 games for Neil Lennon’s side and later said he regretted the move to Scotland from Spanish team Getafe.
He left and joined Qatar side Al-Gharafa.
He is back in Spain now with Rayo and in good form.
His team-mate Adrian Embarba gave Vallecano an early lead at home against Real and Miku made it 2-0 in just 14 minutes.
Madrid were without Cristiano Ronaldo for the first time in a Primera Division game this season, due to a thigh problem but Bale got them out of trouble.
The Wales star headed Real back into the game before the break and then grabbed the winner in the 81st minute after substitute Lucas Vazquez had equalised.
Third-placed Real trail join leaders Barcelona and Atletico Madrid by a point with three rounds of fixtures to go.