Gerrans retained the leader's jersey but Ilissi could not be denied his seventh professional career victory which put the 24-year-old Italian in second place, seven seconds behind the Australian.
"I've never believed in my chances to win this stage because I had the impression that Simon Gerrans was by far the strongest," said Ulissi, who crossed the 150 kilometre stage through the Adelaide Hillsline in three hours 52 minutes and 15 seconds.
"I thought he'd be unbeatable but I managed to beat him thanks to the help of the great team I have behind me."
Australian road champion Gerrans closed on Ulissi but could not overtake the Italian.
Far from being upset, the Orica-GreenEdge rider was focussing on Thursday's race featuring the notorious Corkscrew Hill climb shortly before the finish in Campbelltown.
"It was close but I can't win them all," said Gerrans.
"He's (Ulissi) a classy rider. But I wasn't expecting he'd pass me as fast as he did.
"... it's a good result for me today as I have a bigger advantage over my other rivals with the time bonus of the second place.
"Tomorrow is going to be the most decisive stage with the Corkscrew climb so close to the finish."
Cadel Evans' third place on the stage helped the 2011 Tour de France champion jump from ninth overall to fourth, 13 seconds off the lead.
"I went too early, and got swamped at the finish," said the BMC rider Evans.
"I hope to get it right in the next few days, I didn't have the legs and timing to do it today."
Stage two result
1. Diego Ulissi (Italy / Lampre) 3:52:14"
2. Simon Gerrans (Australia / Orica) ST
3. Cadel Evans (Australia / BMC Racing)
4. Francesco Gavazzi (Italy / Astana)
5. Robert Gesink (Netherlands / Belkin)
6. Richie Porte (Australia / Team Sky)
7. Ben Hermans (Belgium / BMC Racing)
8. Fabio Felline (Italy / Trek)
9. Javier Moreno (Spain / Movistar)
10. Daryl Impey (South Africa / Orica)
1. Simon Gerrans (Australia / Orica) 7:12:31"
2. Diego Ulissi (Italy / Lampre) +7"
3. Andre Greipel (Germany / Lotto) +11"
4. Cadel Evans (Australia / BMC Racing) +13"
5. Francesco Gavazzi (Italy / Astana) +17"
6. Robert Gesink (Netherlands / Belkin)
7. Daryl Impey (South Africa / Orica) +21"
8. Brent Bookwalter (U.S. / BMC Racing)
9. Nathan Haas (Australia / Garmin)
10. Rory Sutherland (Australia / Tinkoff - Saxo)