Jose Mourinho's men rarely threatened and failed to have a single shot on target in the 90 minutes as Basel completed a shock double over the 2012 champions.
The winner came with just three minutes left as the hugely impressive Egyptian Mohamed Salah broke clear and slotted home past Petr Cech.
But with Schalke drawing 0-0 at Steaua Bucharest, Chelsea are through despite their defeat, while Basel have moved into second and a draw with the Germans in their final match will see them through with the English outfit.
The Blues, 2-1 winners at St Jakob Park in the Europa League semi-final first
leg in April, were under pressure from the start on this occasion.
Chelsea might have gone in front after 15 minutes but a Branislav Ivanovic cross was just out of Samuel Eto'o's reach.
Otherwise, it was all Basel and Cech saved an inswinging Taulant Xhaka free-kick, reached to claw away a dangerous Valentin Stocker cross and turned a deflected Fabian Frei shot round the post.
When he was beaten by Ivan Ivanov's toe-poke at a corner, John Obi Mikel scrambled clear.
Cech then tipped over Salah's drive from the edge of the area and from the resulting corner, the Blues survived a penalty claim against Lampard when the ball ricocheted off the midfielder's arm inside the area, with referee Stephane Lannoy deeming no spot-kick.
Chelsea deployed the same three-man midfield of Mikel, Lampard and Ramires which performed so well in Saturday's 3-0 win at West Ham, with Willian's inclusion for Hazard the only change.
Basel, though, bossed central areas and the movement of Frei and Salah caused particular trouble.
The pair combined and Salah struck from 12 yards, a deflection almost seeing the ball elude Cech, who was on his knees when he palmed the ball over.
Marco Streller fired wide from Salah's cross under pressure from John Terry before Cesar Azpilicueta recovered to execute a well-timed tackle on the winger as he shaped to shoot inside Chelsea's area.
Fernando Torres, fit again after missing three games with an adductor injury, replaced Eto'o after 42 minutes when the Cameroon striker was taken off on a stretcher after falling awkwardly and Eden Hazard followed him into the fray 10 minutes into the second half.
Torres and Hazard combined but the latter's heavy pass to Ramires halted a promising move.
Serey Die was booked for a foul on Hazard, presenting Chelsea with a free-kick from a promising position, but Lampard's shot was poor and Ivanovic cleared.
The Blues were more robust in the second half, but even when Yann Sommer's poor clearance presented Hazard with the ball the visitors contrived to fluff the attack.
With the game becoming more stretched as the match entered the final 10 minutes, Die fired wide at the end of a Basel counter attack and then Fabian Schar's long-range effort was held by Cech.
Kevin De Bruyne was introduced for Willian with four minutes to go but from the restart, Basel broke and scored.
Salah got in behind the Chelsea defence to meet Schar's brilliant long-range pass and drove down the right before lofting a neat finish into the net.