Ancic will meet holder Thomas Johansson, who ended local interest when he beat Russian wildcard Igor Kunitsyn 6-3, 7-6. Victory on Sunday would clinch the Swede's third St Petersburg title.
Johansson, 31, who also won here in 1997, led 4-1 in the second set before the 128th-ranked Kunitsyn claimed the next four games to force a tiebreak.
The Swede, however, raced into a 6-0 lead in the tiebreak to secure victory.
"It was a very, very tough game as Igor played very well from the baseline and he is also very quick," Johansson told reporters.
"At 4-1 he took some chances and I started to be a little tight but I got a bit lucky in the tiebreak."
Ancic broke the 204th-ranked Gulbis, making his ATP debut, twice in the first set and once more in the second.
"The match was actually much tougher than the score indicates," said Ancic, the only seed left after a rush of injuries decimated the $1 million tournament.
"I had to save six break points against a player who has big potential and didn't have too much to lose."
Looking ahead to the final, the 22-year-old Croat said: "I just have to continue playing good tennis.
"It will be very difficult to beat Thomas because he has already won this tournament twice and feels almost at home here. Besides, he is also one of my best friends on the tour and it'll be something special to play him."
Johansson said: "Yes, we're very good friends. We both live in Monaco and often practice together.
"We played once before and he beat me then. Mario is also having a very good year but hopefully St Petersburg is my tournament."
The win over the 18-year-old Gulbis kept alive Ancic's chances of securing a spot at next month's season-ending Masters Cup.
He is 11th in the ATP Race with 349 points, 61 points behind eighth-placed Spaniard Tommy Robredo, who lost in the first round here.
The top eight are guaranteed a spot in Shanghai. Ancic will gain 38 points if he wins in St Petersburg.