Stuttgart scraped into the last 32 of the Europa League by the narrowest of margins despite ending their Group E campaign with a 1-0 defeat at home to Molde.
Davy Angan scored the only goal at the Mercedes-Benz Arena to earn the Norwegians, who could not progress, their second win over the Bundesliga club.
However, FC Copenhagen's 1-1 draw in Steaua Bucharest meant Stuttgart held on to second place in the group by virtue of a better head-to-head record over the Danish club.
Molde had already beaten the German side earlier in the competition, and Jo Inge Berget created the first chance after nine minutes with a right-footed strike from 20 yards which fell wide of the right post.
Ibrahima Traore responded with a shot for Stuttgart six minutes later, but visiting goalkeeper Espen Pettersen was equal to the challenge.
Berget tried his luck once more soon after and goalkeeper Sven Ulreich was almost caught out, leaving it late to parry the ball away.
Ulreich was called upon again after 23 minutes to punch clear a testing free-kick from Magnus Eikrem, and made another good save moments later to deny Angan as Molde threatened once more.
Stuttgart looked a little more adventurous as half-time approached and Pettersen was kept busy by a Martin Harnik strike and a header from Shinji Okazaki.
But Molde took a deserved lead on the stroke of half-time when Martin Linnes supplied a ball into the area which was swept home from close range by Angan.
Stuttgart looked a different side after the interval and Pettersen found himself fending off early shots from Shinji Okazaki and Harnik.
Tamas Hajnal then produced a right-footed volley after 56 minutes which was blocked on the line by Angan, helping out in defence.
The home side continued to pour forward but Christian Gentner fired wide from outside the area and Pettersen saved another effort from Harnik as luck deserted Stuttgart once more.
Substitute Raphael Holzhauser and Hajnal then drove shots wide of the mark as further chances went begging for Stuttgart.
Molde had spent the whole of the second half on the back foot, but were denied a second goal four minutes from time when Ulreich palmed away Magne Simonsen's drive and a follow-up header from Daniel Chukwa.