TiVo (Nasdaq: TIVO) is an odd duck. A former Motley Fool Stock Advisor pick and market darling, TiVo's video recording boxes are giving way to myriad knockoffs. Sales have stalled, profits are rare, and cash flows are spotty at best. This should be an instant "sell" in any reasonable investor's book.

And yet this could be the best investment you ever made, if the stars align just right.

Invest in this loser? No way!
This is hardly the golden age for TiVo. Subscriber counts have dwindled over the last couple of years as partners Comcast (Nasdaq: CMCSA) and DIRECTV (Nasdaq: DTV) shuffle in and out of the relationship. You can go to Best Buy (NYSE: BBY) and pick up a TiVo box yourself if your cable or satellite carrier doesn't carry the product, but few consumers choose to go that route. The company is inching out of the hardware business altogether to focus more on high-margin, low-cost software sales instead, but that move has yet to make any significant difference to operations.

The balance sheet looks clean with no debt and a reasonable cash cushion to keep the machinery running, but that's only because TiVo prefers to sell more stock whenever cash balances run low. Heavy dilution is not good for existing shareholders. This is a stalling tactic and nothing more.

The light at the end of the tunnel
But TiVo has a good reason to delay what looks like inevitable doom for as long as possible. All it takes for TiVo to turn around is that a couple of judges rule in TiVo's favor in a handful of key legal battles. If EchoStar (Nasdaq: SATS) and Dish Network (Nasdaq: DISH) end up losing the complaint TiVo originally brought against them way back in 2004, it will not only instantly refill TiVo's war chest but also validate the business value of TiVo's software and patents.

In a heartbeat (or bang of the gavel), TiVo would become a licensor of the DVR technology that consumers worldwide have grown addicted to over the last decade or so. Armed with legal decisions and a fortified patent portfolio, the company would be a lock to start collecting license fees for every DVR component installed by Comcast, Time Warner Cable (NYSE: TWC), DIRECTV, Dish, and pretty much every other cable operator in existence.

What's the payoff?
To see how big of a deal this would be, take a look at TiVo's stock chart over a couple of years. The company's market value is liable to nearly double every time a favorable ruling is issued in the EchoStar/Dish case, but then it falls back to earth again when the defendants take the case to the next available level of appeals. And even then, we're looking at market reactions to an unconfirmed outcome -- far from a sure thing until the final judge or justice has the last word. When the appeals run out, the final reaction should be much bigger.

After all, we'd be watching a money-losing chump on life support turning into a viable business with automatic cash-cow potential. Technology licensing is a popular business model, but it only works if the courts have made it crystal clear that you have the right to collect those payments.

Recommendation: buy, but tread gingerly
In the end, TiVo is not for the weak of stomach or heart. Your investment returns depend to a very high degree on what the legal system's black box decides to output in the end. TiVo has won nearly every skirmish of the battle so far, but that's no guarantee of final success. I am not a lawyer and not qualified to judge the outcome of a legal campaign; maybe you are, and then you can.

But if you're willing to live with massive amounts of uncertainty for an undetermined length of time, the final payoff could be well worth it. I'm thinking about going there myself. For now, I'll have to settle for an "outperform" rating on the stock in CAPS. Just don't mortgage your house to buy more TiVo stock, OK? But it's a buy recommendation from where I sit, based on the idea that the patent system might actually work in TiVo's favor.

Do you agree? Disagree? Fill in the blanks in the comments below. I'm dying to hear what I missed.