Using WinExplorer I determined that the black flickering and Preferences window being hidden behind the main Blender window in Fullscreen mode were being caused by the WS_POPUP window style flag.
This patch removes the WS_POPUP flag and refactors the getState() function logic to use WS_DLGFRAME | WS_MAXIMIZE to determine if the window is maximized, as WS_DLGFRAME is removed when in Fullscreen mode, but present when maximized.
Side note: this is my first time compiling Blender and creating a diff. I hope this is all correct. Apologies for any mistakes or omissions.