I changed the value of EmulateThirdButtonTimeout to "750" and it's working much better now. I will update the script to make this configurable in the conf file and I'll set a more sensible default.
These are the XKB patches that are downloaded and applied to /usr/share/X11/xkb/symbols/nokia_vndr/rx-51. If you want to restore the original file just run apt-get --reinstall install xkb-data.
If that's what's causing it, I think we're looking at a driver patch to fix it.