In Unreal Engine 4.12.3 and 4.12.5 there is a bug in the editor where sometimes if you left click you can turn, but it moves you at the same time and if you right click it moves you backwards unless you move your mouse forwards, once you stop moving the mouse again and only hold right click it moves backwards again.
I have not seen this on my end. Have you been able to reproduce this in a clean, blank project with no additional content or is it limited to one project? Are you holding any other keys or buttons when this occurs?
The reason I ask if any other keys are being held is there are several hotkeys that change the mouse functionality based on what is pressed. If you go into Editor Preferences>Keyboard Shortcuts, you can see which key bindings affect the mouse and see if these are reproducing the effects you are seeing.
The only other things I can think of that could be causing the error:
Check to see if you have an xinput controller (xbox controller or ps4, etc.). If you do, unplug it before opening the editor, then plug it back in. This is a known issue.
Check a different mouse to see if you get the same results.
Unfortunately, without more information or a reproducible case there is nothing I will be able to do on my end. If you find a consistent reproduction case or some steps to try, please post back here with updated steps and I’ll be happy to take a look. Until such time, I am marking this as answered for tracking purposes.