Actually, I spend some time thinking about this trouble... and came to conclusion that this is the case we have encountered (and solved) a couple of times ago.
The trouble is that you actually would need to perform needed actions AFTER DocEdit::LeftDown (or other routine that moves focus as the reaction to user input event) finishes. In other words, after input event is processed and all widgets are stable again.
U++ has a tool for this: PostCallback. PostCallback records a callback that has to be invoked when processing of the input queue is finished (queue is emptied) (it actually works by placing callback to timer queue with zero delay).
So what in fact you need to do is use this to post callback, then release capture and you should be fine...