I believe that Masterson's descendants continued to serve in the regiment until it was lost to amalgamation in the 1960s. The grandfather of Nolan (of Balaklava fame) was a trooper in a cavalry regiment, who bought his son a commission with his winnings from the looting of Joseph's baggage train after Vitoria.
If this was the Elley who commanded the RHG at Waterloo, then his father owned an eating house in Wapping, so was probably not short of a bob or two, even if not "proper gentry". It was said that the term "gentleman" was frequently entered under "father's occupation" at this time in order to disguise tradesmen.
Wellington's Army in the Peninsula by Michael Glover has an excellent chapter on how the army was officered. IIRC, he estimated that there were more officers promoted from the ranks (5%) than there were sons of the aristocracy (and that is ignoring the other 5% who were gentlemen volunteers).