I've actually had this problem a few times, and I use an X-Arcade encoder at the moment. I had your EXACT problem, buttons 5 and 6 stop working on Player 2.
What it was for me was Mame itself. I went into the settings for Mame and saw that Player 2 button 5 and 6 weren't assigned. I thought, "Weird." So I assigned them, and everything was cool. Then I extracted version .71 overtop of version .70, and the buttons stopped working again. So I just reassigned them again. Right now everything is fine, but I have a hunch that when .72 comes out, and I upgrade, I'll have to do the same thing.
So, first things first, go into the Mame config and see if the buttons are not assigned. If that happens to be the case, let me know, cause I'd be interested to see if anyone else was having the same problem I had.