Valentin Stocker's goal in the final five minutes ensured FC Basel will go to Germany with a 1-0 advantage over Bayern Munich in their Champions League last 16 contest.
Stocker was left unmarked to slot the ball between Manuel Neuer's legs in a match where neither defence covered itself in glory.
The first half was breathless with both sides coming close and Basle twice hitting the woodwork but it was the Swiss side who eventually prevailed to take a narrow lead to Munich.
The Bundesliga side raced out of the blocks with Franck Ribery a constant menace in the early minutes, although Bayern were also grateful to Jerome Boateng whose perfectly-timed tackle on Xherdan Shaqiri stopped the Switzerland midfielder in promising position.
It was a breathless opening to the game with the hosts also showing as an attacking force.
Marco Streller's flick was pushed over by Neuer, who was rescued by the woodwork moments later when an unmarked Alexsander Dragovic sent a firm header in on goal which hit the keeper on the forearm before coming off the inside of the post with Holger Badstuber clearing off the line.
Just three minutes later Basle hit the woodwork again when Alexander Frei got between two defenders but his first-time left-footed shot hit the bar. Sommer then did well to intercept David Alaba's shot with the ball swerving at the last minute before Ribery unleashed another shot to test the goalkeeper.
The second half showed little of the space both teams had found in attack with the defences far tighter.
Philipp Lahm tested Sommer with a fierce shot from distance which was pushed away for a corner before Mario Gomez was thwarted when he beat the offside trap and attempted to push the ball across the goal but the keeper stood up as the Bayern player shot at him.
Robben was blocked by Dragovic as he attempted to squirm free in the six-yard box and it was Bayern who were on top. However, that was before Stocker's intervention with four minutes left.
Jacques Zoua ran from right to left along the edge of the area without any real challenge and passed the ball to Stocker on his left. He had lost his marker and he slotted home through Neuer's legs.
In the night's other game, Marseille left it even later to get victory, with Andre Ayew securing a 1-0 triumph against Inter Milan.
An entertaining contest looked to be heading for a draw, until the diminutive Ayew was in the right place at the right time to head home from a corner deep into injury time.
Inter were improved from the side that went down 3-0 to Bologna on Friday for their third straight home defeat, but still looked sluggish at times and there were clear signs of anxiety as their woeful run continues.
Ayew headed in from a corner he had won in the third minute of injury time to make it six defeats out of seven for the Italian giants.
Although a 1-0 scoreline by no means eliminates Inter as they head back to the San Siro for the second leg, Ranieri must wait to see if his paymasters allow him to stay in charge for that match.