The 25-year-old Cima, who placed second in last year’s La Popolarissima, finished the 222km stage in 4:56:05.
Pascal Ackermann (Bora-Hansgrohe) sprinted through from the peloton to finish second and take the sprinter classification jersey, while Simone Consonni (UAE Team Emirates) placed third.
“I can’t believe what just happened. I’ve spent so many kilometres in breakaways during this Giro. I thought I’d never make it but I’ve won today. It’s insane. It’s the dream of a lifetime,” said the stage winner.
With 3.5km remaining Nico Denz (AG2R La Mondiale) attacked, with Mirco Maestri (Bardiani-CSF) and Cima on his heels.
Denz was brought back with 2.5km to the finish and a gap of 30 seconds to the peloton.
The three played cat and mouse as they entered the final hundred metres.
Cima opened the sprint to the finish to cross the line first and take the stage win.
This trio formed the first break of the day, which only appeared after 58km.
They had a maximum lead of six minutes and 20 seconds over the peloton with 106km to go, but it dipped down to two minutes and 50 seconds with 63km remaining as they reached Conegliano for the intermediate sprint.
The gap between the three-man breakaway and the peloton stood at two minutes and 33 seconds with 20km to the finish.
At the 10km-to-go banner the gap was one minute and seven seconds and kept going down, but the break managed to hold off the peloton until the final sprint at the finish.
Richard Carapaz (Movistar Team) kept the maglia rosa as riders head into the 151km 19th stage that takes place from Treviso to San Martino di Castrozza tomorrow.
“It was a very long stage, it was intense only at the beginning then it was pretty quiet. I had the support of the team once again,” said Carapaz.