Roglic was involved in a crash on Thursday, but the Slovenian rider attacked with just over 1 kilometer remaining of the 239-kilometer (149-mile) route from Follonica to Trevi.
Adam Yates crossed the line three seconds behind Roglic, and Tiesj Benoot was a further three seconds behind in third.
''It was my tactic to attack from far out because I've already lost some sprints in my career,'' Roglic said. ''I couldn't wait till the end so I just went flat out after I got a gap.
''I came to Tirreno-Adriatico for GC but I lost my hopes yesterday. My bike was damaged in the crash. So I switched focus to on other goals. I got my stage win and I'm happy with that.''
Thomas moved into the lead with the same time as Greg Van Avermaet of BMC, who won the opening time trial. Pre-race favorite Chris Froome moved up to third, three seconds behind Thomas, his Team Sky teammate. Another Team Sky Rider, Michal Kwiatkowski, is fifth, nine seconds behind Thomas.
There were a number of crashes on the hilly route, one involving race leader Patrick Bevin. Simon Geschke was the worst affected and had to be taken to the hospital.
The fourth stage on Saturday is a rolling 219-kilometer (136-mile) route from Foligno to Sarnano-Sassotetto, ending in a mountain-top finish.
''A lot can happen tomorrow. It's a long climb and having strength in numbers is good,'' Thomas said. ''Hopefully I'll feel good but if I don't then hopefully Froomey or Kwiato will be on a good day, too. We've got options. It's a great position to be in.''
The race ends Tuesday.