Manchester City’s Oleksandr Zinchenko fired in an unstoppable shot in the 27th minute to give Ukraine the lead but two minutes from the interval, Emil Forsberg levelled with a deflected strike from 25 yards – his fourth goal of the competition.
A compelling contest continued after the break with Forsberg twice hitting woodwork but with no more goals, it went to 30 additional minutes where Italian referee Daniel Orsata, with the help of VAR, sent off Sweden’s Marcus Danielson in the 99th minute for a high tackle on Ukraine substitute Artem Besedin.
The 10-men Swedes looked as though they would hold out for penalties but as the match edged into three minutes of added time, Dovbyk headed in a cross from Zinchenko from close range.
Now, after a night of exertion and drama in Glasgow, Ukraine will take on Gareth Southgate’s side, who beat Germany 2-0 earlier in the day, in Rome on Saturday night.
Sweden made the early running but in the 10th minute their goalkeeper Robin Olsen had to produce a fine save from Roman Yaremchuk’s well-struck drive after captain Andriy Yarmolenko had set him up inside the box.
Back came the Swedes and Alexander Isak finished a fine move by curling a drive from inside the box just past the far post.
Ukraine, however, took advantage of the next opportunity they created.
Yarmolenko flicked a pass to Zinchenko from the other side of the box and a powerful left-footed strike from the talented 24-year-old went straight through Olsen.
The stunned Swedes almost responded immediately with captain Sebastian Larsson’s long-range free-kick almost wrong-footing Ukraine keeper Georgiy Bushchan, who parried for a corner which he collected with ease.
However, Bushchan had little chance when Forsberg took a pass from Isak and drove in from 25 yards, the ball taking a nick off Illya Zabarnyi before flashing past the keeper and settling in the net.
Both sides went for it again after the break and Larsson came close with a drive from distance before Ukraine’s Serhiy Sydorchuk and then Forsberg hit the outside of the post with efforts at either end.
Just on the hour mark, Isak failed to connect properly with a long ball over the top and missed the target with only the keeper to beat, albeit he may have been offside.
Bushchan saved from Dejan Kulusevski’s curling shot from 16 yards and at the other end Olsen gathered a shot from Yarmolenko, also from inside the penalty area, before the influential Forsberg crashed a drive from the edge of the box against the bar.
Kulusevski had a chance in the final minute when he raced clear of the Ukraine defence but his shot was brilliantly blocked by back-tracking defender Oleksandr Karavaev.
Then came extra-time and the dismissal of Danielson, after he was initially shown a yellow card, for his challenge on substitute Besedin which required him to be replaced by Viktor Tsygankov.
Dovbyk, on for Yarmolenko at half-time in extra-time, scooped a chance over the bar after 112 minutes – he could have been offside – but he made up for it and then some when he stooped to head in a dramatic winner.