Stocks don’t get much more contrarian than TransAlta Corporation (TSX:TA)(NYSE:TAC).

The company has struggled for years now. Back in early 2014, it was weighed down by costly, unexpected repairs and maintenance, a bloated balance sheet, and weakness in the Albertan power market. TransAlta officially lost its status as a widows-and-orphans stock when it slashed its quarterly payout from $0.29 per share to $0.18.

After the first dividend cut, things went from bad to worse. In 2015 Alberta elected an NDP government that pledged to free the province of coal-fired electricity. Shares plummeted because investors weren’t sure just how bad the new rules were going to be. The company took the opportunity to slash the dividend again all the way to $0.03 per share each quarter.

TransAlta will not only be forced to shut down a number of its coal-fired plants early, but it’ll also have to pay a carbon tax starting in 2017.

A combination of these factors has pushed down TransAlta shares close to all-time lows. Shares currently trade hands at $6.69 each, a decline of 70.2% since 1999. No wonder everyone hates the stock.

Amid all this carnage, some investors are smelling opportunity. Yes, really. Here are three reasons why TransAlta shares could have huge upside.

Renewables stake

In 2013 TransAlta decided it would drop down some of its renewable power assets into a separate entity called TransAlta Renewables (TSX:RNW). Multiple transactions later, Renewables boasts 40 different operating facilities across North America and Australia.

Currently, TransAlta owns 64% of its subsidiary. It has the stated goal of keeping this ownership stake between 60% and 80%. Additionally, both companies have identified additional assets TransAlta could potentially sell to Renewables, including much of Alberta’s total hydroelectric supply.

As it stands today, TransAlta Renewables has a market cap of $3.06 billion. This would make TransAlta’s stake in the subsidiary worth $1.95 billion. TransAlta shares have a current market cap of $1.91 billion.

This means the market is valuing TransAlta’s legacy business at zero. I’m the first to admit these assets aren’t exactly in vogue right now, but they’re worth more than nothing.

Free cash flow

Even through all of its struggles, TransAlta has consistently posted positive free cash flow in the neighborhood of $1 per share annually.

And 2016 is expected to be similarly profitable. Management is projecting the company will earn between $0.82 and $1.03 per share in free cash flow for the year. That puts shares between 6.5 and 7.8 times free cash flow, making the company one of the cheapest in Canada on that metric.

Approximately 40% of the company’s free cash flow comes from its coal-fired assets. This will likely go down come 2018 because of the carbon tax, but still, TransAlta will be comfortably profitable.

Improving Albertan electricity prices

Even though TransAlta is doing many of the right things to turn itself around–like cutting costs, selling assets, and paying down debt–the company still needs one other thing to start going its way.

Spot power prices have to get better in Alberta.

Most of TransAlta’s production is locked into power purchase agreements. Power produced is sold to utility companies, manufacturers, or energy producers at a fixed fee for a certain length of time. These revenues are nice and steady–exactly what a power producer wants.

The rest of the company’s production gets sold at market rates, which have plunged to as low at $20 per MW. That compares to a high of more than $80 per MW during boom times in 2006-07.

The good news is, analysts expect spot prices to head much higher as the carbon tax gets implemented. In a recent investor presentation, TransAlta projected spot prices to more than double between now and 2018, reaching an average of $45 per MW.

TransAlta shares are truly cheap, trading for only the value of its Renewables stake. Any number of catalysts could take them much higher.

Why we're buying more of this "Wall-Street Darling" that was left for dead!

The savvy team of analysts and advisors inside Stock Advisor Canada, recently issued a "buy" alert on this downgraded stock. After being left for dead by five or more big banks in a five-week span, our team scooped up shares as fast as we could--and are recommending that Stock Advisor Canada members jump on this rare opportunity immediately. So simply click here to unlock the full details behind this new recommendation and join thousands of others inside of Stock Advisor Canada.

NEW! This Stock Could Be Like Buying Amazon In 1997

For only the 5th time in over 14 years, Motley Fool co-founder David Gardner just issued a Buy Recommendation on this recent Canadian IPO.

Stock Advisor Canada’s Chief Investment Adviser, Iain Butler, also recommended this company back in March – and it’s already up a whopping 57%!

Enter your email address below to claim your copy of this brand new report, “Breakthrough IPO Receives Rare Endorsement.”

Fool contributor Nelson Smith owns shares of TRANSALTA CORPORATION.