Barcelona manager Xavi Hernandez, on his 43rd birthday, guided his team to a nervy victory, thanks to Dembele.
The coach defended Dembele when taking over at Barcelona in November 2021, saying that with hard work he could be the best winger in the world.
"The most important thing is having the mentality that you will make the difference at Barcelona," Xavi told reporters on Wednesday.
"For me, Dembele is still one of the best in the world in his position. I am happy for him because he's a good guy and a good professional.
"He has turned things around and that is not easy at Barca."
The Catalans came out of the blocks quickly and Robert Lewandowski had an effort blocked after the electric Dembele found him.
At the other end Takefusa Kubo crashed a shot against the crossbar, as the game ebbed and flowed in entertaining fashion.
Barcelona fans frequently showed their ire towards referee Jesus Gil Manzano in the first half -- he was the official who sent off Lewandowski against Osasuna in November, resulting in a ban which the Pole is still serving in La Liga.
However it was Real Sociedad midfielder Mendez who was sent off at Camp Nou on Wednesday, just before half-time.
The Spaniard lunged in on Sergio Busquets, catching his compatriot with his studs above the ankle.
Early in the second half, Barcelona broke the deadlock when Jules Kounde slid Dembele in down the right wing and he drove into the box and lashed the ball past Alex Remiro at the near post.
It was the French forward's third goal in six games and another sign of his superb form under Xavi.
"It's hard to stop a player at such a level, in form and having a day like this," said Alguacil.
"We made things too easy for him in the first half ... I think we were afraid. If you give half a metre to Dembele, you're screwed."
Now that Dembele has found a coach who believes in him -- and signed a new deal last summer -- he has become vital at Barcelona.
"(Dembele) had a great game, we know what a great player he is," Barcelona defender Ronald Araujo told Movistar.
"He helps us with goals, he's taking good decisions, that's the most important thing, something that maybe was tricky for him at the beginning."
Real Sociedad, despite their numerical disadvantage, battled well and should have levelled when Alexander Sorloth fired over from only a couple of yards out.
The Norwegian striker had netted five goals in his previous six games and looked aghast at his miss.
Gavi struck the bar after more good work by Dembele as Barcelona tried and failed to seal the win with a second goal.
"There are a lot of games that we can put to bed earlier, we will try to work on that," said Barcelona defender Alejandro Balde.
"We are in very good form and we just have to kill off these situations."
Barcelona survived two late scares after Marc-Andre ter Stegen gave the ball away but then saved from Robert Navarro and produced another fine stop to deny Jon Ander Olasagasti.
Elsewhere Osasuna earned a 2-1 win over Sevilla in extra-time to reach the semis for the first time since 2005, when they finished as runners-up to Real Betis.
On Thursday Real Madrid host Atletico Madrid and Valencia welcome Athletic Club in the other quarter-finals.