The Slovenians had two shots on target in the opening 12 minutes - the same number they managed in the entirity of their draw with Denmark - and the best of the first-half openings.
On 38 minutes Elsnik hit the near post with a powerful effort. The rebound fell to Benjamin Sesko, but the tall striker - previously linked with Arsenal and Manchester United - skewed his shot wide.
At the other end, Serbia talisman Aleksandar Mitrovic was twice denied excellently by Slovenia goalkeeper Jan Oblak one-on-one.
Slovenia continued to push after the break, Predrag Rajkovic going full stretch to tip over a Sesko drive - but he could do nothing to deny Karnicnik, who sent the white-shirted supporters into raptures.
The right-back was then the hero at the other end as he made a last-gasp block to deflect Mitrovic's close-range volley on to the bar.
The story seemed written that the smallest nation at Euro 2024, with a population of 2.1 million, would secure a historic win.
But just as the mood was turning nasty with warnings broadcast at the stadium in Munich for fans to stop throwing bottles, Jovic stepped up to keep Serbia's tournament alive and break Slovenian hearts.