Toprak muscled onto a corner four minutes after half-time before blasting in a goal that proved decisive after Shakhtar Donetsk lost 1-0 at Manchester United.
That was enough to send Sami Hyypia's side up into second place in Group A and into the last 16.
Bayer created plenty of chances in the opening half without finding the goal they required to keep their Champions League campaign alive.
Simon Rolfes was busy in the heart of midfield, dragging an early speculative 25-yard drive wide.
Gonzalo Castro then hit the post with a free-kick and when the ball rebounded nicely for Stefan Kiessling his shot was straight at the goalkeeper.
Sociedad's best avenue forward was through Antoine Griezmann, who passed a late fitness test, although his best efforts were most often from long range and failed to test Bernd Leno in the Bayer goal.
Emre Can was making a nuisance of himself for the German side and his excellent free-kick was headed over by Rolfes.
Both sides were then restricted mainly to long-range efforts as the game remained goalless going into half-time.
Hyypia sent on Robbie Kruse for the returning Jens Hegeler at the break and the Australia forward almost made an instant impact.
His cross from the right presented Kiessling with an excellent chance to score but Enaut Zubikarai made a good block.
Bayer did not have to wait long to open the scoring, however, as Toprak scored from the resultant corner.
The Turkey defender barged his way onto the flag-kick and when the ball kindly dropped to him Toprak thrashed it in.
It was almost 2-0 moments later as Kruse floated a cross up for Kiessling who thundered his header against the woodwork.
Zubikarai again did well when Kruse and Kiessling combined again before Son Heung-min blazed over after controlling Lars Bender's cross with his chest.
Bayer kept pushing for a second, with Kruse proving a key addition, and while it did not come it mattered not as Phil Jones' winner at Old Trafford ensured they went through.