Since you have the I6, it could be that your pressure switch is failing intermittently or the plug/socket is not tight or has oil in it. On the I6, there is a switch that tells the ECM whether there is oil pressure or not. The ECM makes the gauge move to simulate oil pressure as the engine RPM changes.
I would start at the switch and check it and the harness.