The operation will prevent Cain from throwing for about 10 days and calls into question whether or not he will be ready for the start of the season.
"I hate to speculate," San Francisco general manager Bobby Evans told reporters. "It's the start of spring. Three weeks from now, this would be tough to overcome."
Thursday marked the second time in recent months that Cain has undergone a procedure to eliminate the cyst. He had it drained over the winter but it soon returned.
Cain, who will make $20 million this season, is looking to bounce back from consecutive injury plagued seasons.
He was just 2-7 with a 4.18 ERA in 15 starts in 2014 before undergoing season-ending elbow surgery. Last season, he was 2-4 with a 5.79 ERA in 13 appearances (11 starts) after returning from a forearm injury.
Cain has won 12 or more games five times in his career but the last time he did so was in 2012 when he went 16-5 with a 2.79 ERA.