Meaning and etymology of "twirling waxed mustaches"

In the sense of 'twirling waxed mustaches': Dastardly Whiplash

An oddly specific kind of character, the Dastardly Whiplash is a cartoonish villain taken from the silent film tradition [1891-1920]. Usually a Man of Wealth and Taste, in Great Britain (cough Evil Brit cough), he was generally a Bad Baronet; in the U.S., he was often an Evil Banker who held the mortgage on the heroine's farm. Physically, he's slightly hunched with an exaggerated nose and chin, a curling black moustache (all the better to twirl at you, my dear)

and: JSTOR

At home, too, beards and mustaches reflected a kind of masculinity that was falling out of favor. In 1920, Alma Whitaker, a Los Angeles Times columnist, complained that “tricky little mustaches” found on men returning from World War I

I appears from vaudeville to the the 'talkies' to the dashing soldiers of WWI returning, the twisting part came to connote 'evil design'. My sense would place this figurative usage in AmE at the turn of the 20th C.