Early uses do not necessarily express the first part ("flay you") outright; it was (and is), however, understood that a 'hide' cannot be tanned until the animal has been skinned.
Plainly, 'tan' in the early use found in Coffey's play is being employed with the metonymic sense of 'beat'; already, before 1732, little of the literal sense of 'to tan', that is, "to cure leather with tannins", remains in Coffey's use, which seems to have been, um, 'lifted', more or less directly, from Jevon's earlier (before 1688) use 'lam' of in the sense of "beat".
The same metonymic distillation of 'tan' into the sense of 'beat' as was seen in Coffey's 1732 play can be found in another 1732 publication, a translation of Molière's The Miser, where the translation of je vous rosserai is "I shall tan your Hide." The French verb rosserai translates literally as "whip", "flog", "trounce", "beat up", etc. It is, however, beyond my expertise to say which meaning was likely in French of the 1600s.
None of the foregoing is conclusive with respect to my claim that, after examining the historical evidence given above and more, 'tan your hide' referred not so much to discoloration of skin as to a beating so severe as to flay the recipient, followed by a promise to tan the hide removed by the flaying. Either explanation of the origin of the term (that it refers to skinning followed by curing, or that it refers to simple discoloring) might serve as well as the other; however, in the absence of direct historical evidence contradicting my observations, mine is the more likely explanation of early use of the phrase.