La Liga champions Atletico Madrid remain four points behind leaders Real Madrid as they lost at managerless Real Sociedad after being reduced to 10 men.
It was just Sociedad's second league win of the season, having beaten the table toppers earlier in the campaign.
Atletico top scorer Mario Mandzukic scored a close-range opener before Carlos Vela curled in a leveller.
Visiting defender Guilherme Siqueira was booked twice in three minutes as Imanol Agirretxe headed the winner.
Diego Simeone's men were looking for their fourth straight La Liga win but they showed defensive frailties as they slipped to just a second league defeat of the season to stay in fourth in the table.
The defeat could have been heavier as the hosts had two good penalty appeals turned down, one after a challenge on Vela by Diego Godin and the other for handball against Cristian Ansaldi.
Real Sociedad went into the match in the relegation zone, despite coming from 2-0 behind to beat Real 4-2 in August, but deservedly claimed the points to lift them to 15th.
They are expected to appoint a full-time replacement for Jagoba Arrasate, who was sacked last week, in the next few days.