To be clear at the outset, a red herring is not a species of herring nor a genetic oddity, like an albino sperm whale, but simply a herring that has been smoked. Many early references to “red herring” in matches found by a Google Books search focus on the commercial trade in red herring, or dwell on the differences between fresh (or white) herring, salted herring, pickled herring, and red herring. Others treat a red herring as a kind of embodiment of a very modest meal.

'Red herring' as a false trail

Previous answerers have noted the OED’s recent attribution of red herring in the sense of “false trail” to William Cobbett in a story published on February 14, 1807. But the Cobbett instance is at least 25 years later than two occurrences in Google Books search results where red herring has that same figurative sense. The first confirmed relevant match that a Google Books search finds is from a speech by Mr. Courtenay on March 20, 1782, reproduced in the section on “Simile” in The Beauties of the British Senate: Taken from the Debates of the Lords and Commons (1786):

Though I have not the honour of being one of those sagacious country gentlemen, who have so long vociferated for the American war, who have so long run on the red-herring scent of American taxation, before they found out there was no game on foot ; they who, like their prototype, Don Quixote, have mistaken the barber’s bason for a golden helmet ; I now congratulate them on having at last recovered their senses, and found out their error.

Also relevant is this item from The Sportsman’s Dictionary; Or, The Gentleman’s Companion for Town and Country, Second Edition (1782):

But if it has happened that your exercise has been so easy so easy as not to sweat your horse thoroughly, then you ought to make a train scent of four mile in length, or thereabouts, and laying on your fleetest dogs, ride it briskly, and afterwards cool him in the field, and ride him home and order him as has been before directed. A train scent, is the trailing of a dead cat or fox, (and in case of necessity a red herring) three or four miles, according as the rider shall please, and then laying the dogs on the scent. It will be proper to keep two or three couple of the fleetest hounds that can possibly be procured, for this purpose.

The first edition of this book was published in 1778, but I haven’t been able to find a previewable version of it.

A match that is potentially even earlier, but is limited to a snippet view and therefore not fully confirmed, appears in The Universal Museum and Complete Magazine, volume 2 (1763, date not confirmed) [combined snippets]:

Lord G. It is right, however, that mankind should pursue it. It is productive of many good effects. The trumpet of fame rouses great minds to great actions. Lord O. And to many bad ones too. Fame, you know, my Lord, has two trumpets. And though the pursuit of it may be good exercise for the general pack of mankind, and keep them in breath, it seems (to speak in my favourite language of a sportsman) to be only hunting a trail, to catch a red herring at last.

The reference to red herring here appears in the midst of a dialogue between the earls of Orford and Granville that other sources, including The London Chronicle, date to 1763, but without the "red herring" language anywhere to be found. Various snippet-view searches within the Universal Museum volume indicate that the probable date of the issue in question is June or July 1763—but the very presence of red herring in the Orford-Granville dialogue recorded there is mysterious, if not a red herring.

'Red herring' in the cause of sophistry

Another possible connection between “red herring” and false reasoning involves this first half of an anecdote from “The Spiritual Quixote,” in The Critical Review or Annals of Literature (1773):

A Roman Catholic Gentleman went a Partridge-shooting along with a Protestant neighbor of his on a fast-day : they were driven, about noon, by a thunder-storm, to a little public-house, where they could get nothing to eat but some bacon and eggs. The good Catholic had a tender conscience, and would eat nothing but eggs; the Protestant, his companion, who was one of your good sort of people, said, 'there could be no harm in his eating a bit of bacon with his eggs ; that bacon could not be called flesh ; that it was no more than a red-herring ; it is fish, as one may say.’ So the Catholic took a bit of bacon with his eggs.

'Red herring' as a practical-joke reward

Yet another possibility arises in the context of a memorable practical joke. From Gerard Langbaine, “Jasper Main,” in An Account of the English Dramatick Poets (1691):

He [Main] Died on the Sixth day of December, An. 1672, and was Buried in Christ-Church on the North-side of the Quire : having in his Will left several Bequests to Pious uses. As Fifty Pounds to the Re-building of St Pauls ; A Hundred Pounds to be distributed by the Two Vicars of Cassington and Porton, for the use of the Poor of these Parishes, with many other Legacies : amongst which I cannot forget One, which has frequently occasion’d Mirth at the relation. He had a Servant who had long liv’d with him, to whom he bequeath’d a Trunk , and in it Somewhat (as he said) that would make him Drink after his Death. The Doctor being dead the Trunk, was speedily visited by his Servant with mighty Expectation, where he found this promising Legacy to be nothing but a Red-Herring : So that it might be said of him [Main], that his propensity to innocent Raillery was so great, that it kept him Company even after Death.

The same story about Dr. Jasper Mayne, with the same punch line, appears almost a century later in William Owen & William Johnston, A New Biographical Dictionary, Containing an Historical and Critical Account of the Lives and Writings of the Most Eminent Persons in Every Nation, Particularly the British and Irish, From the Earliest Accounts of Time to the present Period (1784):

It is remarkable of this divine [Mayne], that, though very orthodox in his opinions, and severe in his manners, he was a most facetious and pleasant companion, and so wonderfully fond of joking, that he even contrived to do it after he was dead. Thus Langbaine, in his account of him, relates, that he had a servant, who had long lived with him ; to whom he bequeathed a trunk, “with something in it,” as he said, “which would make him drink after his death.” The doctor dying, the servant immediately paid a visit to the trunk ; but instead of a treasure, or at least a valuable legacy, which he expected, he found nothing at all but a red herring.

Similar accounts appear in John Noorthouck, An Historical and Classical Dictionary (1776) and in David Baker and Isaac Reed, Biographica Dramatica, Or, A Companion to the Playhouse (1782). Apparently, among the class of seventeenth- and eighteenth-century Englishmen who had servants, this tale of posthumously raising and then dashing a longtime servant’s hopes was simply too droll a joke to forget. In this case, a red herring is a disappointing reward in place of something that one has imagined and expected to be extremely valuable.

Conclusion

In all three cases (red herring as dog-training scent, red herring as consubstantiated bacon, and red herring as false prize at the end of long service), the fish can be seen as a metaphor for deception. Of the three, the dog-training scent red herring seems the likeliest to be the source of today’s term, but the practical joke red herring seems to have been around the longest, and it is not impossible that all three sources may have influenced today's general notion of a figurative red herring as something fundamentally misleading.