- Switzerland dominate but Milivoje Novakovič gives Slovenia first-half lead
- Boštjan Cesar heads in after break to double visitors' advantage
- Substitute Josip Drmic's strike reduces arrears; Valentin Stocker makes it 2-2
- Drmic finishes deep into added time to earn a notable victory
- Next games: England v Switzerland, Slovenia v Estonia (8 September)
Switzerland turned defeat into victory in the closing minutes in Basel, substitute Josip Drmic putting the finishing touch to a remarkable success which strengthened his side's hold on second place in UEFA EURO 2016 Group E.
A Switzerland team with seven Bundesliga players in their lineup looked to have proceedings under control in a first half they dominated. However, some stout Slovenian defending ensured the closest the hosts came to an opener was Timm Klose's close-range attempt which was superbly denied by Samir Handanovič.
Heading into first-half stoppage time, Slovenia capitalised on a rare counter, Josip Iličić threading through for Milivoje Novakovič to dink over Sommer and give Srečko Katanec's men a surprise lead.
Minutes after the restart the Swiss crowd were stunned into silence again, Boštjan Cesar wrestling to beat his man in the box and nod in Valter Birsa's corner to make it 2-0. It could easily have been three moments later but Iličić's flick was foiled by Sommer.
Switzerland coach Vladimir Petković threw on strikers Breel Embolo and Drmic in an attempt to force a breakthrough at the other end, and the two combined to cut the gap to 2-1 on 80 minutes.
Josip Drmic thumps in Switzerland's late winner
Spirits were soaring four minutes later as Xherdan Shaqiri clipped the ball back from the touchline for another substitute, Valentin Stocker, to equalise.
Amazingly, there was more drama to come. With Slovenia off balance in the dying seconds, Fabian Schär tried his luck, his low shot fended away by a defender but only as far as Drmic, who finished from close range.