The win moved Villarreal to second place in the league table with 24 points, just one adrift of leaders Real Madrid, who suffered a 2-0 defeat to Sevilla on Saturday.
Los Rojiblancos slipped to fifth spot on 20 points.
Atletico defender Pablo Ibanez broke the deadlock after nine minutes and Simao Sabrosa doubled the lead in the 24th minute.
The Portuguese winger curled in a superb shot that went into the far top corner from just inside the area.
Italian striker Giuseppe Rossi pulled one back for Villarreal six minutes later.
He took advantage of some sloppy defending to loop the ball over Atletico's advancing keeper Leo Franco.
Argentinean defender Fabricio Fuentes drew the Yellow Submarines level four minutes before the break with a low shot from inside the area.
Maxi Rodriquez could have scored for Atletico when his side were awarded a penalty but his shot missed the target.
In the 61st minute, Fuentes' in-form compatriot Sergio Aguero rose to receive a free-kick with a glancing header that bounced off the ground and went into the net to restore Atletico's lead.
However, former Real Sociedad striker Nihat equalized eight minutes later when he capitalized on Luis Perea's failure to clear the ball to poke home past Franco.
Picked out unmarked on the left side of the area, Nihat stunned the Vicente Calderon crowd when his low drive struck the back of the net to give Villarreal a precious victory.