Ukraine broke the deadlock when a passing move just before the half hour found Oleksandr Zinchenko at the back post and his rasping half-volley was too strong for Robin Olsen.
Sweden equalised on the stroke of half-time through Emil Forsberg's deflected effort from distance and the striker twice hit the woodwork after the break.
Marcus Danielson was sent off in extra time and Ukraine made the extra man count when Zinchenko's cross was headed in from close range by substitute Dovbyk to set up a last-eight tie with England.
Sweden began with the greater intensity but it was Ukraine who carved out the first meaningful effort on goal when Roman Yaremchuk's low shot was kept out by the diving Olsen.
Alexander Isak dragged an effort wide of the post for Sweden before a slick Ukraine interchange culminated in Andriy Yarmolenko's deft cross with the outside of his boot which Zinchenko crisply finished.
Sweden almost hit back instantly when Sebastian Larsson's opportunistic curling free-kick from long distance had Georgi Bushchan scrambling across goal.
The leveller soon followed, Forsberg showing quick feet to create a shooting opportunity from outside the box as his strike took a defection off Illia Zabarnyi and flew beyond Bushchan.
Both sides struck the woodwork early in an open start to the second half as Larsson and Forsberg grazed the post either side of Serhiy Sydorchuk's shot which rebounded off it.
Bushchan produced a superb diving save to keep out a Dejan Kulusevski curling shot which seemed destined for the top corner before Forsberg jinked inside and bent another effort against the crossbar.
Kulusevski had a chance for Sweden at the end of normal time when he controlled a long ball but his angled shot was kept out by a last-ditch block from Oleksandr Karavaev.
Sweden's Danielson was sent off in extra time following a VAR review for a dangerous high tackle on Artem Besedin which left the Ukraine player unable to play any further part.
Spot-kicks loomed but Dovbyk popped up with the winner, heading in Zinchenko's cross from close range in injury time at the end of 120 minutes.