Have you ever been this close to buying a stock, only to miss it for some reason or another -- and then watched it go up day after day, month after month? Every time I hear about one of these just-missed stocks, I cringe. Since you don't learn anything from avoiding your past mistakes, I thought it'd be a great exercise to reexamine some of the biggest stocks I missed ... stocks that our Motley Fool Inside Value newsletter shrewdly rode to sizable gains.

MasterCard (NYSE:MA)
Arghhhh! MasterCard, I never got a chance to know you. I wanted to. I had a price target for you not too far from your IPO price, but you never met me halfway -- you just kept going up and up and up.

Since Inside Value recommended MasterCard less than a year ago, the stock has increased almost 150%. I tried to wait for the price to drop, in an attempt to time the exact bottom. At the time, there was a risk that MasterCard would have to make a big payment because of litigation from Morgan Stanley's (NYSE:MS) Discover unit and American Express (NYSE:AXP). I figured I'd wait until an adverse ruling happened, then buy shares at the bottom. Unfortunately, that never happened.

The team over at Inside Value avoided this mistake because it ran the numbers. It made conservative estimates about how big a hit the company's intrinsic value would take if MasterCard had to make a big payment, and found that even if this happened, shares were still undervalued. Investing is about weighing risks and rewards. In this case, Inside Value's math showed the odds tipped heavily toward "rewards."

Lesson learned:
Look at each investment from different angles. If the most pessimistic assumption still gets you a price substantially higher than the going rate, it's time to open your wallet.

CarMax (NYSE:KMX)
Slightly more than a year after Inside Value recommended it, CarMax has appreciated more than 80%.

I remember looking at CarMax at the time, unable to see what all the hoopla was about. Although it was obvious to me that CarMax was the type of company I like (it focuses on treating customers right), I didn't think it was the type of stock I like. Based on trailing multiples, it just didn't seem cheap enough.

My mistake here was investing with an eye on the rearview mirror, rather than concentrating on the road ahead of me. I overlooked the potential that the Inside Value team saw in CarMax.

The company had plenty of room to grow its market share, and thus sales and revenues, for a long time. Its business model -- making used-car buying simple and somewhat enjoyable -- was unique compared to competitors, be they Ford (NYSE:F) and GM (NYSE:GM) dealerships or fellow car retailer AutoNation (NYSE:AN). The Inside Value folks also saw that the company's margins would expand as stores matured and operating expense leverage kicked in -- something that, again, I didn't fully appreciate.

Lesson learned:
Value and growth are two sides of the same coin. If a company's strong growth prospects aren't baked into its stock price, it could be a buy. To gain a better understanding of growth prospects, research the company's market opportunity, competitive advantage, and potential future cost structure on a unit basis.

In the end, it isn't fun to go back and revisit your mistakes. But it's important to acknowledge and learn from others who were able to make the correct decision. Doing so should help us become better equipped to make the right decision the next time around.

Related Foolishness:

CarMax and MasterCard are Motley Fool Inside Value recommendations. Discover all of Philip Durell's savvy value-stock picks with a free 30-day trial subscription.

Fool contributor Emil Lee is an analyst and a disciple of value investing. He doesn't own shares in any of the companies mentioned above. Emil appreciates your comments, concerns, and complaints. The Motley Fool has a disclosure policy.