Football seasons can pivot on certain moments and Thomas Frank will hope that Crystal Palace’s turning point came 17 minutes from full time here. Deservedly trailing to Mamadou Sarr’s goal having been second best throughout against Real Sociedad, this game – and perhaps the south London club’s entire trajectory – was turned on its head after Jon Martín was sent off for denying Jean-Philippe Mateta an equaliser.

The France striker made no mistake with his penalty before Dwight McNeil – who made up for scoring an own goal in Saturday’s defeat by Coventry capped an extraordinary comeback in Frank’s first home match since succeeding Pierre Sage. Despite Yéremy Pino’s saved penalty in stoppage time and a number of other chances that were squandered, Dean Henderson pulled off a stunning late save to seal the victory and revive Palace’s Europa League campaign. Suddenly Palace have hope where there appeared to be none and the Premier League’s bottom side will head into Sunday’s crucial showdown with Hull with a spring in their step.

“It’s a season where the confidence maybe isn’t the highest, to then go on and win the game is fantastic,” said a delighted Frank, who conceded there had been a few “heart-attack moments” late on. “You can’t underestimate what a win does for a group.”

Related: Reinildo error extends Sunderland woe as Jagiellonia grab Europa League draw

Frank had urged the Palace supporters to ensure the atmosphere was “through the roof” for his Selhurst Park debut, although it wasn’t until Mateta’s goal that they really found their voices. Sociedad have struggled in this competition despite a promising start to their La Liga campaign and their manager, Pellegrino Matarazzo, was at a loss to explain how his side failed to record only their second victory other than blaming the referee.

Their version of the 4-4-2 formation functioned so much more effectively than Palace’s, with Mateta and Eddie Nketiah forced to feed off whatever scraps that came their way during the first half. Almost all of Frank’s squad – including the two substitute goalkeepers – had spent a substantial part of the warm-up practising defending set pieces so there was no doubt where his priorities lay. But the Palace manager didn’t look amused when Sarr was inches away from connecting with a free-kick in the second minute.

Ben Chilwell looked unsettled by the pace of Héctor Fort and Sociedad began to target the defender’s left flank. Not for the first time, Palace had Henderson to thank for keeping the scores level when he parried two shots from Gonçalo Guedes in the space of two minutes away to safety. Mateta had to wait until the final minute of the first half for a sighter and the France striker could only nod over from a long Chris Richards throw.

Henderson was called into action again twice inside the opening six minutes of the second half as Sociedad smelled blood. Mikel Oyarzabal should have rounded off a lightning quick break downfield but could only shoot straight at the England goalkeeper before Jon Gorrotxategi took aim from the edge of the area. With his side struggling to gain a foothold, Frank abandoned his experiment with Nketiah and brought on McNeil to try and give Chilwell a helping hand. Yet it was down Palace’s left flank that Sociedad finally found the breakthrough when Sarr touched home Job Ochieng’s cross.

To their credit, Palace’s response was immediate. Axel Disasi won a header from another long throw and Martín hauled down Mateta as he was about to score, earning a second yellow card. Mateta dispatched the spot kick with aplomb and only a desperate goalline clearance from Sarr denied Daichi Kamada. Frank went for broke by throwing on Jørgen Strand Larsen and his gamble paid off when the Norway striker’s attempted overhead kick presented McNeil with the easiest of opportunities to lift the gloom in these parts.