Real Sociedad launched a second-half comeback at Estadi Cornella-El Prat to prevail 2-1 against Espanyol on Saturday night.
Jhon Cordoba had given the hosts the lead just after the half-hour mark with a neat finish.
The game was turned on its head after the interval, though, as Antoine Griezmann headed an equaliser and then Christian Stuani miscued his attempted clearance into his own net a minute from time to hand the visitors the win.
The result lifted Sociedad up a place to sixth in the Primera Division standings and left Espanyol ninth.
Sociedad mustered the best chance of the first quarter on 18 minutes when Carlos Vela's header played in Imanol Agirretxe, who got away a sharp left-footed shot on the edge of the six-yard box but was denied by the outstretched left leg of Espanyol goalkeeper Francisco Casilla.
Two minutes later Casilla pulled off another fine save low to his left from an Agirretxe header, before realising the flag had been raised for offside anyway.
Espanyol went within inches of opening the scoring in the 25th minute when Sergio Garcia played in David Lopez. He stayed on his feet when it seemed he may have been being tugged back by Javier Ros, but his honesty was not rewarded as his little dink over Claudio Bravo trickled just wide.
The home fans were cheering the game's first goal six minutes later, though. Hector Moreno supplied the ball from the back and Sergio Garcia's dummy allowed it to run through for Cordoba, who closed in on goal and coolly slotted past Bravo.
It could have been even better for the Barcelona outfit before half-time when Sergio Garcia's first-time effort arrowed towards the bottom-right corner, but Bravo turned it away and they had to settle for a one-goal interval lead.
Sociedad raised their tempo after the break and had Espanyol on the back foot, although the hosts were not helped by the loss through injury of goalscorer Cordoba.
Alberto De la Bella's left-footed attempt was tipped around the post by Casilla in the 65th minute.
And, four minutes later they were level, when Casilla flapped at a Vela cross from the right and Griezmann nodded into an empty net.
It looked like the points would be shared, but, a minute from time, Sociedad nicked all three - in bizarre fashion.
From a short corner, Ruben Pardo sent in a cross which was horribly miscued by Stuani and the ball spun past a helpless Casilla.