It was only a few years ago that Panera Bread Co. appeared to have run its course of extraordinary success. Following years expansion at a breakneck pace and steadily and sharply rising profits, the company struggled in the middle part of the decade. The company’s share price in December 2007 was down more than 50% from highs set in March 2005.

Not only has the company recovered from its slump, financial data issued last week underscored the spectacular dimension of the recovery. The company’s third-quarter earnings of $22.8 million were up 21% from the third quarter last year. More impressive, though, the company’s chief executive officer noted that Panera profits have increased by more than 20% in 9 of the last 10 quarters. Total and same-store sales growth has been impressive, too.

How did Panera effect this turnaround during what has been the most difficult period for restaurants ever?

The company may have benefited from its mid-decade stumble when it introduced a pizza-like product called Crispani. The product was reasonably popular but too labor intensive, significantly compressing the company’s margins. Crispani was dropped from the menu, and the experience prompted Panera to work intensively to balance product innovation and customer loyalty without ever surrendering profit margins.

The c.e.o., Bill Moreton, said last week the goal is to “elevate our customers’ experience and create “real, sustainable points of competitive difference.” He expects another year of 20% growth in 2011. Investors appear impressed, too. Panera shares hit an all-time high last week of $95.41, more than triple the January 2008 low of $30.60.