Player dies to drowning in P_CheckUnderwaterAndSpaceTimer
P_KillMobj strips you of all properties a dead player shouldn't have, such as MF2_DONTDRAW (the fix for a similar bug elsewhere in the code)
P_KillMobj initiates state change from S_PLAY_PAIN to S_PLAY_DROWN
P_SetPlayerMobjState, when the current state is S_PLAY_PAIN, sets pw_flashing to flashingtics-1.
pw_flashing means P_PlayerThink toggles MF2_DONTDRAW on further down the main function
P_PlayerThink ends, and is not called again next tic due to using the death thinker, which means MF2_DONTDRAW is never removed
The fix either involves bailing from P_PlayerThinker if the player is killed during it, making sure not to set pw_flashing in P_SetPlayerMobjState if the player is dead, only doing the MF2_DONTDRAW toggle if the player is alive, or some combination of these.