It was a captivating performance from one of the veterans on the tour, who had not won a title since 1996 in Toronto.
Ferreira raised his arms in triumph after a forehand by Hewitt sailed long on the South African's first match point to give Ferreira his 14th career title.
"The older I am, the better I am," Ferreira said after picking up the winner's check for dlrs 434,000. "Age and experience got me through."
Hewitt, an Australian who has won four titles this year, was seeded eighth. He earned dlrs 228,000. Hewitt is sixth in the Champions Race that will produce the new No. 1 for the year at the end of the season. Ferreira moved two spots to No. 11.
Ferreira wasted two set points in the first tiebreaker _ one with a forehand that went just wide and then a backhand down the line that was no more than an inch (2.5 centimeters) off.
But on Ferreira's third set point, Hewitt hit a forehand wide.
Helped by breaks of serve at the start and at the end of the set, Hewitt breezed through the second and jumped to a 5-1 lead in the third.
Ferreira saved one set point while serving in the eighth game. A netted forehand saw Hewitt drop the next game.
The South African was in trouble again in the 10th game but saved five more set points then forced Hewitt into an error and hit a service winner to level the score.
Ferreira then hit a return winner to break Hewitt's serve and take a 6-5 lead. But he was unable to serve out the set and Hewitt forced a tiebreaker.
He was down 3-1 but produced some spectacular shots to come back. One such shot was a backhand winner hit while chasing back a good forehand from Ferreira.
Pumping his fists, Hewitt blasted a forehand to the corner, Ferreira got his racket to the ball but it sailed long to give Hewitt the third set.
"I just didn't want to lose," Ferreira said. "I wasn't going to give up, I'd come too far for that."
Both players held serve in the fourth to go into another tiebreaker, Ferreira winning this time easily.
Hewitt committed a double-fault to drop his serve right at the start of the final set.
Ferreira broke serve again for a 3-0 lead and cruised through.
"I didn't think I could last as long," he said. "It was probably the best week I've ever had."
The dlrs 2.96 million Stuttgart Masters Series is one of the nine tournaments that rank just below the four Grand Slams in terms of prize money and importance.
"To finally win a tournament this big at this stage of my career is fantastic," Ferreira said.
Hewitt said he had been weakened by a virus about two weeks ago and still wasn't fully fit.
"Match fitness was a telling factor in the end," the Australian said.
Hewitt's girlfriend, Kim Clijsters of Belgium, won the women's tournament in another German town, Leipzig, on Sunday.
(AP)