Image source: Flickr user mendhak.

Being a successful contrarian investor necessarily about buying what stock is the most hated; it's more about buying stocks nobody thinks can change. Really, it's about buying those stocks that considered dead and buried but in fact could still make a transformation and take the stock much, much higher.

Take Netflix (NASDAQ:NFLX), for example. Believe it or not, it once mailed out DVDs in red envelopes to movie fans of all kinds all over the country. But those who thought this company would be unable to transition to the Web wrongly sold the stock. And what's crazy is how quickly the transformation happened for Netflix. Before you could say "Reed Hastings," the company was focused entirely online, with DVD mailings diminishing every month. If you didn't buy shares of Netflix when it seemed idle, then you missed the big move higher in the stock. Sure, Netflix hit some speed bumps in its transition (remember the Qwikster fiasco?), but the stock went down to $66 a share and is now around $360. That's well more than a 400% move.

NFLX Chart

NFLX data by YCharts.

Take another recent example like Best Buy (NYSE:BBY). Everyone thought Best Buy couldn't make it, what with people using its stores as showrooms for products they would later by online. Yet Best Buy has experienced a resurgence, and the stock has soared from $11 to $41. New CEO Hubert Joly, a corporate turnaround expert, has cut costs and overcome the showrooming phenomenon by giving customers what they want. Best Buy started matching the prices of the products of 19 online competitors, thus getting customers to buy in store.

BBY Chart

BBY data by YCharts.

And then there's Hewlett-Packard (NYSE:HPQ). Nobody thought HP could turn its huge, employee-heavy company around -- and certainly not so quickly. Yet CEO Meg Whitman seems like the right fit for the company. While HP missed all the upside in the tablet and smartphone revolution, the company is now focusing on the cloud, big data, and corporate solutions. I don't see Whitman making crazy billion-dollar acquisitions for temporary gains, as previous CEOs did; she's looking at the long term. That's probably the smartest thing Whitman is doing: She's not chasing growth, but trying to cut costs, streamline, and build from within.

Meanwhile, the talking heads on TV were screaming that HP was done for, finished, dead. And yet HP's stock price rose from about $12 per share to more than $27 today -- all while keeping its fat dividend.

Be careful, though: There are companies -- for example, BlackBerry (NYSE:BB) -- that might be dead and buried with little chance of revival. There are still dedicated BlackBerry users and companies that value the devices' security -- including President Obama, for one. But BlackBerry is hoping to sell itself, rather than return to the glory days when it was called Research in Motion. One sign of a dying company is that its last-gasp effort is try to copy competitors. True, Microsoft does this all the time, but it has money to burn -- BlackBerry doesn't. BlackBerry tried to copy Apple with its touch screen technology when perhaps it should have focused on its core market -- those people who like the keyboard and the security aspect of the phones' emailing service.

BlackBerry almost seems to have conceded defeat. There's no new CEO coming in who wants to revive this company, at least at this point. Right now, Apple has 40.4% of the smartphone market share, Android has 51.8%, and BlackBerry is third with just 4.3%. And this subscriber base is dwindling for BlackBerry, down 0.7% from the previous month. Obama might be the last BlackBerry user left when all is said and done.

How to spot the hidden gems
The key is finding companies that can transform. Often it takes new CEOs to lead them back to the land of the living, but it might also take a new strategy. However, taking over other companies and trying to buy growth is unlikely to resuscitate a dying company. Look for companies that are cutting costs, making customers happy, and sticking to their core values.

Fool contributor John Webster has no position in any stocks mentioned. The Motley Fool recommends Netflix. The Motley Fool owns shares of Netflix. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.