Yes an oil pressure safety switch (OPSS) that is bad, or has a broken wire, will cause these symptoms. You can get them from an auto parts store for about $20-30.
In boats with an electric fuel pump, regulations require that you have a OPSS that prevents a non running engine to continually pump fuel with the ignition switch set to run. While cranking, the fuel pump is powered from the starter solenoid and runs. After the engine starts, and the ignition switch returns to run, the OPSS is closed if it senses oil pressure - usually about 4 psi, keeping the fuel pump pumping and away you go. If it does not sense fuel pressure, the OPSS switch opens and the fuel pump turns off. A broken OPSS is open, so after the cranking stops, the fuel pump turns off, causing the engine to stall, and preventing the fuel pump from dumping gas into your bilge.