Actually the VMI cadets whipped Yankee ass at the Battle of New Market. But I believe the one scene you refer to out of 'The Horse Soldiers' might be a Hollywood takeoff of the actual battle.
http://www4.vmi.edu/museum/nm/index.html
VMI '70
In The Horse Soldiers, John Wayne's column is attacked by cadets of The Jefferson Military Academy, which is depicted as a military school in rural Mississippi, and a Confederate battery. The scene is played for laughs, and nobody gets hurt as the Union cavalry retires at speed rather than fight a formation of boys.
Interestingly, though, the headmaster of the academy, who leads the charge, is an ordained minister (Leonidas Polk was an Episcopal bishop) and carries a Bible into the fight as his sidearm.