Master swordsmen throughout history have lost to amateurs, since the amateur hasn't learned what's supposed to be possible or impossible. They just attack, block instinctively, and use their wits since they haven't been fully trained. Luke wasn't nearly fully trained when he fought Vader either time. Yet still held his own (Mostly due to the fact that Vader didn't want to kill him.)
Palpatine was technically an amateur compared to Yoda as well. Yoda, with over 800 years of sword mastery under his belt, got beat by Palpatine. How? Was Palpatine THAT much stronger in the Force than Yoda???? Or did he use his wits to counter everything the wily little Master could throw at him?
On a side note, STILL love the look on Yoda's face when he started that platform spinning before tossing it at Palpatine in Episode III. The look that said "You're goin' down, boy!"