I have this problem when filling up my tank over halfway (have a ej22 99 legacy). replaced everything it could be except the vapor return system and the fuel tank filler pipe.
mine dies randomly at any rev/any speed. it misfires and sometimes throws a code for a cylinder misfire, most of the time not. i tried getting to the filler pipe the other day but the first bolt i tried to remove on the cover cracked off (so rusty). it will probably be mid-late april before i try to remove the other two and the broken one. i'm assuming at this point that there is a hole rusted through the fuel filler pipe and the vapor return system is purging air into the engine, causing the misfire.
i've already replaced the spark plugs, spark plug wires, ecu, battery, and ignition coil. i've also taken pressure readings on the fuel pump and all is good.
mine always starts back up again but it sometimes takes a couple minutes of cranking (on and off).
good luck with yours; odds are it's something that's already been listed