When joints flip during animation, it is because of something called gimble-lock. see http://www.anticz.com/eularqua.htm
Anyways, in your case, you have chose to aim-constrain. You need to adjust your aim-constrain vectors to have it point the right way. i.e. you have an up vector and an aim vector. Adjust those accordingly to get it to aim correctly. Try changing 1 0 0 to 0 1 0.
Anyways, you should be using pole-vector constraints to solve joint flipping, not aim constraints.