Have you checked for spark when it won't start?
You're getting into specifics before you even test the basics... Obviously it is not a fueling issue, my next guess would be a spark issue. Test for spark next time it won't start.
If that happens to be the case then I would check the ECU ground on the driver's side rear of the valve cover. Should be somewhere around there. I had an intermittent spark issue on my Legacy and it happened to be the ECU ground was not torqued properly after I dropped the engine back in