I thought Bond and Q were always annoyed with one another. How come Q has suddenly come to aid Bond in a personal revenge mission?
Not at all. Q is exasperated about what happens to his equipment but he has the up-most respect for Bond. Look at the way he congratulates him on his wedding in OHMSS. And there is a lot of respect in TWINE too (it'a almost grandfatherly).
It was out of character for Q. They have a respect for each other but Q was strictly a "by the book" type. He wouldn't help Bond or any rogue agent on a personal vendetta. Also the convenience of his appearance was just plain ridiculous. That same night Bond realizes he could never penetrate the bullet proof glass in Sanchez's office Q shows up with plastic explosive.