Roku Inc.'s (ROKU) - Get Report  shares fell more than 13% to $36.95 Tuesday after having more than doubled over the prior three trading days thanks to a strong third-quarter report and a software-licensing deal covering Philips-branded TV sets. It's possible that shares still have some room to move higher as more investors grasp the long-term value of Roku's software platform, but the easy money has likely been made.

Still, it's worth taking a look back at what exactly happened with Roku -- in particular, why the stock was undervalued at the time of its late-September IPO, and why it remained that way for more than a month before the third-quarter report acted as a major wake-up call. There are some useful lessons here for finding diamonds in the rough within the tech sector at a time when many quality tech firms whose stories are well-understood are trading at high multiples.

To recap: Roku went public on Sept. 28 at $14 per share, translating to a modest valuation of about $1.5 billion after accounting for outstanding stock options and warrants. Shares blasted off post-IPO, closing their first day up 68% to $23.50, and made it as high as $29.80 on their second day of trading. But they soon pulled back to the low $20s, and eventually fell back into the high teens. Prior to the release of Roku's third-quarter report on the afternoon of Nov. 8, shares closed at $18.56.

Investors quickly began singing a different tune after Roku reported third-quarter revenue of $124.8 million (up 40% annually) and an operating loss of $7.9 million, easily beating consensus analyst estimates of $110.5 million and negative $20.9 million. GAAP EPS was officially negative $8.79, but that was only due to an IPO-related $37.7 million paper loss involving the fair value assigned to preferred stock warrants.

Revenue growth improved from second quarter's 19% gain. But more importantly, virtually all of this acceleration was driven by the fact that Roku's "Platform" revenue, which covers ads, software licensing, transaction cuts and other non-hardware revenue streams, grew 137% to $57.5 million. That was much faster than second quarter's 95%, and led Platform revenue to equal 46% of Roku's total revenue.

Since Platform revenue carried a healthy 77.5% gross margin -- far above the 7.9% GM Roku claimed on hardware sales, which rose just 4% to $67.3 million -- this led the company's operating loss to fall by more than 40% in spite of a 44% increase in operating expenses to $57.8 million. It also led Roku's ARPU -- defined as its Platform revenue per user over the trailing 12 months -- to rise 13% sequentially and 37% annually to $12.68.

Throw in the fact that Roku's active accounts and total streaming hours increased 48% and 58%, respectively, year-over-year to 16.7 million and 3.8 billion, and that fourth-quarter revenue guidance of $175 million to $190 million was mostly above a $177.1 million pre-earnings consensus, and it's easy to see why markets were pleased with the report. Meanwhile, a healthy short interest -- as of Oct. 31, it was equal to 23% of shares sold through the IPO -- provided fuel for a squeeze.

But while some of Roku's numbers were a little surprising, they shouldn't have been shocking. Considering how strong Roku's user engagement was as of the second quarter, and the potential that ads and smart TV software licensing provided as revenue streams, it arguably wasn't that hard to imagine Roku's fairly low ARPU growing strongly in future quarters, provided the company executed well. Nor that Platform revenue would grow stronger still as hardware sales boosted the size of Roku's active account base.

What led many investors to overlook this? I think two factors loom large. One is Roku's popular image as a maker of streaming sticks and set-tops, rather than the owner of a digital media software platform. The other is that its biggest rival is Inc. (AMZN) - Get Report , a company that perhaps inspires more dread in the shareholder bases of current and potential rivals than any other tech giant.

But Roku, which refreshed its hardware lineup and OS in early October, has been battling Amazon's Fire TV hardware line for more than three years, and is still delivering healthy growth due to the quality of its hardware, software and overall ecosystem. And while Amazon's R&D resources, aggressive pricing and ability to promote the Fire TV line to its customer base make it a formidable rival, Roku had produced a blueprint for battling Amazon and others by selling its hardware near cost and finding other ways to profit from its user base.

Though Roku and Facebook Inc. (FB) - Get Report have a ton of obvious differences, in some ways, one can draw parallels here to how markets treated Facebook in the months immediately following its 2012 IPO. Facebook's shares fell over 50% amid fears about the company's ability to monetize mobile activity that was starting to account for a very large percentage of Facebook usage.

Jim Cramer and the AAP team hold a position in Facebook for their Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells FB? Learn more now.

Going into Facebook's second-quarter 2013 earnings report, shares were still only trading in the mid-20s. Then Mark Zuckerberg's company delivered blowout numbers that calmed mobile monetization fears, and we all know the rest.

The early-2017 plunge experienced by security hardware/software firm Palo Alto Networks Inc. (PANW) - Get Report  following a soft January quarter report is also perhaps relevant. Palo Alto, whose next-gen firewalls and subscription services have gotten rave reviews in the IT security world, blamed a billings miss and light guidance on sales execution issues.

But the numbers stoked fears that Cisco Systems Inc. (CSCO) - Get Report was beginning to steal Palo Alto's thunder. Those fears diminished after Palo Alto posted a strong April quarter report that led shares to recover a big chunk of their losses.

On the whole, there might be three big takeaways from Roku's story from tech investors:

    If a tech company has differentiated products and/or services that are beloved by its customer base, but is struggling to sell and/or monetize them, there's a good chance the company will figure it out in time -- provided management can be trusted to execute.

    Don't necessarily run for the hills on news that a tech giant is going after a smaller company with differentiated offerings. Instead, take a hard look at how the tech giant's products and pricing stack up, as well as at how the smaller company has been faring against larger rivals to date.

    When a company is in the midst of a major business model transition, don't immediately assume that "conventional wisdom" about what the company is about is accurate.

    In the current market environment, those maxims can go a long way towards unearthing hidden gems that have a lot more upside potential than stocks that have already taken off over the last two years.