Emil Forsberg’s deflected strike brought Sweden level before half-time and the RB Leipzig midfielder twice hit the woodwork in the second half.
However, a red card for Marcus Danielson nine minutes into extra time left Sweden hanging on for penalties until Dovbyk latched onto Zinchenko’s inviting cross to spark wild scenes of celebration among the small band of Ukrainian fans at Hampden Park.
Shevchenko said before the game his side had already achieved their objective by making it through the group.
But the former AC Milan striker got the reaction he desired after a disappointing 1-0 defeat to Austria in their final group game with a fast start.
Sweden’s Robin Olsen was forced into the first save to deny Roman Yaremchuk after he was teed up by the impressive Andriy Yarmolenko.
The West Ham United winger has been his country’s driving force all tournament, scoring or assisting in all but two of their six goals.
Yarmolenko’s teasing cross with the outside of his left foot fell kindly for Zinchenko on 27 minutes and the Manchester City man drilled in a low shot that had too much power for Olsen.
Forsberg has been just as influential for Sweden as Yarmolenko for Ukraine and he equalised two minutes before the break with his fourth goal of the tournament.
Chances came and went for both sides as an entertaining second half raged from end to end.
Yarmolenko teed up Serhiy Sydorchuk to smash against the post, but Sweden posed the bigger threat.
Forsberg twice hit the woodwork, curling a shot onto the base of the post before a more powerful effort from the edge of the box cannoned back off the bar.
In between times, Georgiy Bushchan produced a stunning save to tip Dejan Kulusevski’s dipping shot over the bar.
Ukraine survived to take the game into extra time and were gifted a golden chance to reach the last eight of a major tournament for just the second time as an independent nation when Sweden were reduced to 10 men.
Danielson won the ball but followed through with a dangerous challenge on Artem Besedin that forced the Dynamo Kyiv striker to come off injured.
Yarmolenko also had to be replaced midway through extra time in what will be a concern for Shevchenko if Ukraine are to have any chance of shocking England in Rome.
But his replacement Dovbyk was the hero as he chose the perfect time to score his first international goal.