CNBC's Jim Cramer often sees the stock market as a fashion show in which stocks fall in and out of style depending on investors' sentiments at the time.

Few stocks embody this back-and-forth better than General Motors, the automaker whose shares were effectively unloved from 2014 to this August, when the stock suddenly broke out.

"Like wide ties, General Motors was out of style for years — until very recently, the skinny tie reigned supreme — but in 2017 the wide tie has made a comeback and so has the stock of GM," the "Mad Money" host said.

With shares up over 25 percent since the end of August, General Motors, once a low-growth, bond-like stock, has become "beloved" by the Wall Street analyst community, Cramer said.

In the last three weeks, analysts from Deutsche Bank, Bank of America-Merrill Lynch and Barclays peppered General Motors with upgrades and the stock caught a wave of price target raises. One Citigroup analyst was so bullish on the $45 stock that he came out with a possible $134 price target.

"That's the kind of coverage you might expect for a fast-growing, cloud-based software stock, not a major American automaker," Cramer said.

Cramer found several possible reasons for General Motors' rally. Its shares caught fire right when Hurricane Harvey hit Texas and potentially destroyed half a million cars. Given that many thought the auto industry had peaked before Harvey hit, Cramer saw the rise in General Motors and other auto stocks as a sign that the "peak auto" thesis would be put on hold.

Plus, General Motors' monthly U.S. sales have been improving, according to the company's latest earnings report. But a one-off hurricane and an otherwise tepid earnings report hardly explained analysts' infatuation with the stock, Cramer said.

The analysts who recently upgraded General Motors cited the company's autonomous driving platform, which Deutsche Bank said would come to fruition much sooner than expected; Maven, its millennial-targeted car-sharing business; and the stock's low valuation.

"Really, though, none of this explains why GM's stock has gone from zero to hero in a matter of just months," Cramer said. "Everything I've just mentioned certainly helps, it's a nice background, but none of it gets at the real issue here. The real reason, I think, for the sudden love [is] you're witnessing a re-rating of GM's shares by the analysts and then a total change in the investor base."

Until recently, many investors saw General Motors' $30-something stock as a value trap, leaving only deep value investors and income-seekers as most of its shareholders.

But even though its new electric vehicle, autonomous driving and ride-sharing initiatives have been underway for years, General Motors has suddenly gotten credit for them all at once. As a result, the stock has surged higher and fallen back into favor with growth investors, Cramer said.

"You get a couple pieces of good news and the whole tone changes," the "Mad Money" host said. "Growth investors start gravitating back to the stock as a poor man's Tesla with a better balance sheet and a ridiculously low valuation. I think GM's shift from value to growth has only just gotten started, and ... any dip will now be officially used as an opportunity to buy, not sell, the stock of the once hated and derided General Motors."