Oh, you're getting the diagnostic from the *connection* handle, not the statement handle. According to the documentation of SQLExecDirect(), it sets the diagnostics on the statement handle.
I agree that psqlODBC's behaviour here is pretty strange, and probably incorrect. I wouldn't expect SQLExecDirect to set any diagnostics on the connection handle, at least for a syntax error. But if it does, the second call probably should do so as well, and overwrite the previous error message.
But the immediate fix for your application would be to get the diagnostics from the statement handle instead of the connection handle.