Vela opened the scoring in the game, which would end up a seven-goal thriller.
The Mexican attacker's goal was his 11th league tally of the season, and 16th in all competitions. His career high for league goals was set last season with 14.
Sociedad appeared to have a share of the points, but Hicham Khaloua scored in extra time to ensure the hosts took the victory.
The loss was a big blow to Sociedad's Champions League hopes, as the side now sits in sixth place, nine points behind Athletic Bilbao in the fourth and final Champions League spot.