Alexander Pope in the poem "Eloise to Abelard" (1717) uses a similar formulation:
Of all affliction taught a lover yet,
'Tis sure the hardest science to forget!
How shall I lose the sin, yet keep the sense,
And love the' offender, yet detest the' offence?
How the dear object from the crime remove,
Or how distinguish penitence from love?
Another invocation of "love the sin, hate the sinner" occurs in William Martin's notes to John Bunyan's hugely influential (in English culture) book, The Pilgrim's Progress, Part II (1684/1786):
Here is the mystery of God's grace, the mystery of precious faith; that, however hateful sin is in the sight of a holy God, however full of sin the sinner is, yet he can love the sinner, as much as he loaths his sin. Why? because he views his elect sinners, in Christ the Son of his love, by whom a perfect atonement is made for sin, his precious blood cleanses their souls from all sin and presents them without spot of sin before God.
Martin wrote his notes to The Pilgrim's Progress sometime between 1777 and 1786 (when a version of Bunyan's book containing Martin's annotations first appeared). In an earlier version of this answer, I had attributed the quoted language above to Bunyan; but as Mr. Bultitude points out in a comment below, the words are entirely Martin's.
A more coherent discussion of the distinction between sin and sinner appears in Isaac Watts, "The abuse of the passions in religion" in Discourses of the Love of God (1729):
There is another Instance of the Abuse of the Passions, which is very near a-kin to this [namely, zeal turned into wrath and fury], and may stand in the next Rank; and that is, when we behold the Vices of Men with holy Aversion and Hatred, and immediately transfer this Hatred to their Persons, whereas we ought to pity and pray for them : Or when we see a Fellow-Christian fall into Sin, and because we hate the Sin, we hate the Sinner too, and suffer our Hatred to grow into Disdain and irreconcilable Enmity, and that even tho' the Offender has given Signs of sincere Repentance. This is not Christian Zeal, but human Corruption; and such criminal Indulgence of the Passions, which ought to be mortified, if ever we should be Imitators of the holy Jesus : He hated even the least Sin, but loved and saved the greatest of Sinners, and delighted to receive Penitents to his Love.