Deuce was first used in 17th-century English in various exclamatory expressions in which it was equated with bad luck or mischief. Because in dice-playing two (deuce) is the lowest and most unlucky throw. From this there soon developed the sense of deuce as the devil (i.e. bad luck or mischief personified). Deuce as a euphemism for the devil occurs in a number of expressions including those above.
RELATED IDIOMS :
a deuce of a = the deuce of a
something very bad or difficult of its kind
1933 - John Galsworthy - The End of the Chapter – It seems there's a deuce of a fuss in the Bolivian papers.