Fornals struck with three minutes left to leave Zinedine Zidane's wasteful side fourth and a whopping 16 points behind runaway league leaders Barcelona, a deficit which will turn into 19 should Barca win at Real Sociedad on Sunday.
Compounding Real's misery is the 10-point gap separating them from second-placed local rivals Atletico Madrid, who moved up to 42 points and within six of Barca after winning 1-0 at Eibar thanks to Kevin Gameiro's 27th-minute strike.
Atletico survived a stoppage-time scare when Augusto Fernandez handled the ball during a goalmouth scramble but went unpunished by the referee.
Real are also eight points adrift of Valencia, who strengthened their grip on third place as goals from Goncalo Guedes and Rodrigo secured a 2-1 win at struggling Deportivo La Coruna.
“We didn't deserve to lose. We had the better chances but the ball did not want to go in,” said under-fire Zidane after Real's second straight home league defeat.
Villarreal meanwhile move up to fifth on 31 points thanks to midfielder Fornals' stunning goal, which puts Javier Calleja's side just a point behind off-form Madrid in the race for the Champions League places.
Real fired off nearly 30 shots but their accuracy was wayward, with Cristiano Ronaldo among the worst culprits in front of goal.
“We did everything we could and there is no explanation for why the ball didn't go in,” added Zidane, who signed a new contract to keep him at Real until 2020 earlier this week.
“I can't criticise my players for anything. This is a bad spell, nothing more.”
So often Real's saviour, Ronaldo had a bad day at the office, with his worst miss coming just before half-time, when the five-time Ballon d'Or winner managed to shoot straight at Sergio Asenjo after being laid on by Isco in front of a practically open goal just yards out.
The Portuguese was livid with the referee, as he thought that he was tripped by Daniele Bonera just before he shot.
Real carried on where they left off in the second period, but after failing to break down the resolute visitors, Fornals stepped up to make history and pile the pressure on Zidane.
Fornals clipped home his 87th-minute winner just after it looked like Enes Unal had fluffed his team's chance to snatch the three points after a blistering counter-attack following a Real Madrid corner.
Turk Unal shot straight at Keylor Navas when put through by Denis Cheryshev, but with Navas still recovering from making the save Fornals lifted the ball over the flailing Madrid stopper.
“You're always happy when you get three points at such a difficult ground,” said Calleja afterwards.
“We knew we could make history today, we believed.”