Pablo Sarabia had the first big opportunity of the game for the visitors, but his effort came back off the post.
Moments later Sociedad were denied by the woodwork, as Chori Castro's strike from the edge of the box crashed against the post.
The visitors came close again soon after when David Zurutuza fired over the bar following a promising run.
However, the hosts could not hold on as in the last minute Karim Yoda drilled a strike in from the edge of the box to level the scores.
There was still enough time for Getafe to find a winner, and in the fourth minute of stoppage time Karim Yoda was found by Campos Sammir inside the box and slotted home to ensure that his team claimed all three points.