Shares of Krispy Kreme (KKD) reached a 52-week high on Friday. Let's take a look at how it got here to find out if it that price can get any tastier for the donut maker.

How it got here
There wasn't any immediate spark that ignited the stock. Rather, Krispy Kreme as a company has been on an upward trajectory over the last few years, and recent fundamentals are encouraging. The company's latest quarter drowned analyst expectations like so much chocolate glazed on a ring of fried dough. In the third quarter, its net profit rose nearly 7% year over year, while revenue of $107 million came in a bit higher than analysts expected.

Even better was the bump in fourth-quarter guidance. The company raised its former $0.36-$0.42-per-share earnings estimate to $0.44-$0.47. That, in particular, gave a nice sugar rush to the shares, which advanced 12% on the happy news.

The consolidation trend sweeping the industry also looks like a factor in the rise of Krispy Kreme. Buyouts are the in thing to do lately in the coffee/sweets world; look at Starbucks' (SBUX 1.00%) $620 million swallow of Teavana and its lunge at privately held Seattle rival Tully's. Financial investors are getting into the act, too, specifically Joh A. Bensicker, with the roughly $1 billion it paid to grab Peet's Coffee & Tea and the $340 million it spent for Caribou Coffee (NASDAQ: CBOU).

Buyers are willing to cough up a lot of scratch to get assets like these. Krispy Kreme has significantly better brand recognition and value than the examples above, and at the moment its market cap stands at $727 million. It's likely that at least some of the investors pushing up its stock price are doing so in the hopes that a strategic or financial investor will float a chunky offer for the company.

From champ to chump
Everyone likes a good comeback story, and Krispy Kreme appears to be one these days. At the start of this century, the stock quickly became one of the market's favorites after its IPO in 2000. Like pastry dough in an oven (OK, OK, we'll stop with the similes now), the share price rose along with the company's good financials. At one point in 2003, it hovered around the $50 mark.

The fun times didn't last, though, and the investor darling became a dog. Hyperexpansion overloaded the market, badly affecting sales and profitability. Unfortunately for the company, this was the heyday of the Atkins Diet, a regime that eliminated carbohydrates from adherents' food intake. Since donuts are basically circles of carbohydrates fried in oil and slathered in sugar, they fell precipitously toward the bottom of America's list of favorite comestibles.

Expansion plus a sharp reduction in popularity is a terrible formula. In May 2004, Krispy Kreme issued its first profit warning, cutting its full-year earnings guidance  by 10%.

It was a year when the company just couldn't seem to do anything right. Not long after the warning, the company found itself the target of an SEC investigation into its accounting practices. Not to be outdone by a simple government regulator, numerous shareholders brought suit against the firm, alleging that management hadn't been truthful about the future direction of the company.

Barely a year after its shares touched that $50 peak, they could be had for less than a third of that price.

They've never really recovered, despite a change in management for the better and a slap-on-the-wrist resolution to that SEC probe. It's tough for any stock to come back in favor once its crashed from a high; investors have long memories and usually don't return to the fire once they've been scorched. Their recollections of lost value burn brighter than, say, the steady increase in fundamentals Krispy Kreme has shown in the last few years, or the five-year PEG of under 1 it's currently sporting -- which handily beats the 1.6 of big rival Dunkin' Brands' (DNKN), the 1.5 of Tim Hortons (THI.DL), or Starbucks' 1.4.

What's next
The market seems to consider Krispy Kreme a sleeper, although that low PEG number is based on anticipation of strong annual growth. What will be crucial over the next two months or so is whether the consolidation trend continues in the company's segment, and how its fourth-quarter results look. If management proves it can push results up substantially, investors will probably continue to grab positions in the stock.

Bulls, after all, like eating tasty treats as much as any of us do.