Scoring his second goal in as many matches - and joining Jamal Musiala on a pair of strikes in the competition's Golden Boot race - winger Ivan Schranz put Francesco Calzona's men ahead in the opening 20 minutes.
The Blue and Yellow - staring elimination at the group stage in the face - were markedly improved after suffering an early setback, with a brilliantly-taken goal from midfielder Mykola Shaparenko restoring parity in the contest.
After being left out from the start, Roman Yaremchuk was handed a 23-minute cameo from the bench and delivered the winning moment, producing an excellent touch and finish to condemn Slovakia to their first loss of the tournament.
Despite the best efforts of the Ukrainian medical team, Everton star Vitalii Mykolenko was once again unable to be selected in the starting XI, meaning that Arsenal's Oleksandr Zinchenko filled in on the left side of the defence for a consecutive game, with the Blue and Yellow missing his calming presence in midfield versus Romania last time out.
Although the majority of the Ukrainian side remained intact from the first fixture, there was a major change in between the sticks, with Real Madrid's Andriy Lunin after an unconvincing performance versus Romania, with Benfica youngster Anatolii Trubin given the honour of being the last line of defence.
Looking to keep a fourth straight clean sheet and book an automatic place in the knockout stages of a major tournament, Slovakia stuck with the same back four that helped them to a vital shutout and maximum points against Belgium, with Inter Milan's Milan Skriniar captaining his nation from the heart of the backline.
Ukraine stare elimination in the face
After such a disappointing showing and subsequent three-goal defeat at the hands of a flamboyant Romania earlier in the week, it was clear that Ukraine had not learnt their lesson immediately and once again fell behind in a Euro contest, putting their progression into the last 16 in severe doubt.
Taking advantage of a lapse in concentration from the Blue and Yellow, Slovakia's David Hancko took a throw-in quickly and found the run of Lukas Haraslin, whose first-time delivery into the box had Zinchenko scrambling backwards, leading to Ivan Schranz having a free header at the back post to fire his side in front.
Having conceded four goals at this competition without reply, it was no surprise to see Sergiy Rebrov's men go on the offensive as they chased parity in the contest before the half-time whistle, with right-back Oleksandr Tymchyk's low-driven effort striking the post of Martin Dubravka's goal and bouncing away from danger.
Although Ukraine were unable to make the net ripple in the opening 45, supporters of the Blue and Yellow did not have to wait long into the second period for their first cause for celebration at this summer's tournament in Germany, with a defensive midfielder stepping up to the goalscoring plate.
With Slovakia penned around their own box, highly-rated Shakhtar Donetsk youngster Georgiy Sudakov found the run of Zinchenko on the left flank, and the Arsenal man delivered a low cross in the path of Mykola Shaparenko, who had found space in between the defensive lines of Sokoli and brilliant finished past Dubravka.
Things were about to get a whole lot better for those of a Ukraine persuasion, with the man who replaced Girona marksman Artem Dovbyk in the 67th minute providing a moment of real attacking quality to make sure his nation have three points to their name after two group matches.
Taking a break from the midfield battle, goalscoring Shaparenko drove into space on the right near the halfway line and played a delicate ball over the Slovakian defence into the path of Yaremchuk, who plucked the pass down from the sky expertly and quickly poked his shot past the attentions of Newcastle United's Dubravka.
What's next for Slovakia and Ukraine at Euro 2024?
Having won their opening match of Euro 2020 before losing twice and crashing out of the competition, Slovakia will be worried that similar collapse could occur in Germany three years on, although any type of result in their final group match against Romania on Wednesday evening should allow them to progress into the last 16.
As for Ukraine, it looked as if Rebrov's boys were set to be the first nation to be effectively knocked out of Euro 2024 as they went into the half-time break alive, however a show of resilience allowed the Blue and Yellow to fight back and secure only their third-ever win in the group stage of this competition.
Celebrations for the Ukrainians will not last too long until the Dusseldorf evening, though, as they still need a positive result against section favourites Belgium next week to ensure that they finish inside the top two of Group E.