For anyone interested, I threw some AHK code together that lets you click your left & right buttons at the same time to get a middle click. This code avoids the problems caused by using the following simple AHK script that sends a middle click whenever the two buttons are held down at once:
~LButton & RButton::MouseClick, Middle
~RButton & LButton::MouseClick, Middle
For example, using my code, you can still hold down the left button and click the right one to jump forward one page in Opera (or whatever). It also keeps the middle mouse button held in until you release one of the two buttons, so for some program that uses middle-click dragging, you should also be able to use this (though I haven't tested that, I don't think I have any program that makes use of a middle-drag).
There are some additional hotkeys included: windows+m toggles the middle-click behavior on and off (if some program refuses to work with it on, this will return your mouse to normal functionality and let you switch back when done). F11 quits the script altogether, and F12 reloads the script from the HD. You'll probably want to leave those last two out at least since they were just for debugging.
You can also adjust how fast you have to be in hitting both at once. The default value which worked well for me was 20ms. Lower values will make it harder to trigger a middle click, but higher values will add more delay to your clicking. That is, if you are just trying to do a left click for example, the program will wait 20ms to see if you're also going to click the right button. After that time has passed without a right click, it will send the left click that you wanted.
I'm not sure that there's any way around adding a delay to make this work, since the program must have some wiggle room for you to click both buttons, but cannot send a click until it knows what you wanted to send. It's not like it can send a left click, then when your right click comes in 10ms later, cancel the left click and send a middle click.
Anyway, a 20ms delay is unnoticeable for me when I'm using my laptop's trackpad, and well worth being able to both have a middle-click and do proper forward/backward gestures in Opera.
Give this a try, let me know what you guys think. I'm sure it could have been coded more elegantly - I threw this together when it seemed that nothing else would do what I wanted to do, and this is the first version that I was happy with.
Edit: to give credit where it is due, this code started out as a copy-paste of one of the AHK example code snippets for the SetTimer function. I also used jgpaiva's code above as a starting point on how to use AHK's mouse functions.