Despite being known as one of the greatest investors of all time, Warren Buffett's had a difficult time with oil and gas companies over his career. But his previous difficulties didn't stop him from upping his stake in Phillips 66 (PSX -0.35%) to $5.3 billion, a 13% increase to start the year. It's the sixth largest equity position in the Berkshire Hathaway (BRK.A -0.30%) portfolio.

Ever since oil prices dropped from $100 per barrel, pundits have been calling for a bottom. Now with oil at $30, Buffett appears to be loading up in this midstream company. He's putting real money to work -- and when the Oracle speaks, I listen. Let's see if he's signaling an opportunity in the energy sector.

The Buffett time machine
Buffett first bought ConocoPhillips (COP 0.64%) in 2007 and added to his position as the stock and oil prices were both at all-time highs. He wrote in his 2008 letter to shareholders that "the terrible timing of my purchase has cost Berkshire several billion dollars."

His most recent investment in ExxonMobil (XOM 0.23%) started in 2013 and lasted only two years before he exited the position. He had this to say about his Exxon: "I did get less enthusiastic about crude oil prices at the time we owned" the stock. "I felt that the future wasn't going to be as good as people were thinking it was going to be."

I, for one, will never underestimate Buffett. Is he likely to make the same mistake three times? Anything is possible, but I wouldn't put money on it.

What should investors expect next?
There are a few key differences this time around. First, this time, Buffett is investing in more of a midstream energy-infrastructure play rather than an integrated oil company. Second, energy and stock prices are at depressed levels, giving Buffett a larger margin of safety.

Buffett doesn't see Phillip's as just another refiner, either. He has great respect for its CEO, Greg Garland, and loves the other side of its business -- chemical and pipeline. As Buffett explains it:

We're not buying it as a refiner. We're certainly not buying it as an integrated oil company. We're buying it because we like the company, and we like the management very much.

Buffett loves betting against the herd, and here he sees something very special in this business -- though he's also very cautious of the sector as a whole. He isn't trying to tell us there's opportunity in the entire sector. That Buffett owns no integrated or E&P companies over 1% in his portfolio is quite telling in terms of his expectation for oil and gas prices. (He holds a 0.63% position in Suncor Energy (SU 0.43%), an integrated oil and gas company based in Canada.)

In fact, his investment in Phillips 66 is significant, because refiners don't necessarily make a lot of money with oil shooting to the upside (or downside). Prices could be range bound for an extended period of time. 

However, Philips isn't as susceptible to the oil downturn as many believe. It should be able to make money in a low-oil-price environment, as well as claim a slow uptick in prices. Ultimately, Buffett is telling us there's opportunity in certain segments of the industry, but you need to pick your spots wisely. Phillips, it appears, is one such spot.