Real Sociedad showed no signs of a crisis in confidence following their 4-0 thrashing in Donetsk by recovering from a goal down to defeat Espanyol.
The early signs were good, with Carlos Vela and David Lopez both having chance to opening the scoring before Jhon Cordoba put the hosts ahead against the run of play after 31 minutes.
The Colombian raced onto Hector Moreno's through-ball - aided by a lovely dummy by Sergio Garcia - and kept his cool to slot past Claudio Bravo.
That had Javier Aguirre's men ahead at the break, but an error from Francisco Casilla gifted Antoine Griezmann his ninth goal of the season.
The former Real Madrid goalkeeper came out to claim Vela's cross but ended up making a hash of it, allowing the French winger to nod home with just over 20 minutes left to play.
There was an element of fortune to La Real's winner, as Christian Stuani sliced Ruben Pardo's weak cross over a helpless Casilla with two minutes remaining at Estadi Cornella-El Prat.
Three points helps Jagoba Arrasate's side into sixth place in La Liga, while Periquitos remain in ninth.