I think that the best solution is getting rid of that console-hiding code, compiling LyX as a console-based app and then using a GUI-based wrapper program for launching LyX from the GUI.
This is what I do with LyX/cygwin, using as a starting point development/Win32/lyxwin32.c, which is specifically designed for cygwin but can be adapted to native windows. I have no cmd.exe window at all when using this technique, while retaining the possibility to get output when launching LyX without using the wrapper.
The more research I have done, the more I tend to like this simple solution. Is this lyxwin32.c actually being used by anyone? I see a windows/msvc equivalence from http://www.msfn.org/board/index.php?showtopic=49184&mode=threaded . Can anyone knowing a bit Russian evaluate the value of this program, or at least translate the comments for me? Cheers, Bo