Contrast this with early stage companies (which is what we're talking about here). VCs don't care as much if a company has a proven business model - what they're looking for is GROWTH opportunity. The opportunity to completely disrupt a huge market or invent a new one. While profitable companies have better odds of surviving long enough to get to that point, they may not be the best investments in the end.
To give you a concrete example of how this could affect investor decision making. Let's say that the total opportunity for Source Code Management solutions is $2bn/year in corporate spending (completely making this number up) - even if GitHub captures 100% of this market, which they won't, they're capped at $2bn/year in revenue, unless they figure out another way to make money. Once they're done paying the sales guys, engineers, and otherwise supporting operations, they make maybe $500mm/year in profit. With a standard P/E multiple, they'd be worth something like $5-$10bn.
Pinterest, on the other hand, has the potential to be the "facebook of online shopping" to amazon's "google of online shopping". If people really engage with pinterest, and they spend a lot of time on the site, and they're more likely to buy stuff when they're looking at what their friends like and are buying, then it could be worth a lot more than that. The point is, while they don't yet have predictable revenues or earnings, their potential market (online shopping) is so much bigger than github's, that it's possible to justify a high valuation based on growth potential.
I'm not saying I buy the Pinterest hype. I'm just saying that there are criteria beyond current profitability and cash flow on which one can value an early stage business.