Nowadays people tend to separate the formal closing (or subscription) of a letter from flow of the preceding main text of the letter. But it was not always thus. In the 18th and 19th centuries, many letter writers tried to move relatively seamlessly from their message to their farewell. Thus we have numerous examples where "yours truly" appears as part of a final sentence and might encourage readers to equate the phrase with the writer of the letter, rather than reading it as a telescoping of the phrase "I am yours truly." For example, from letter of September 17, 1768, to Mr. M————— in Letters of the Late Ignatius Sancho (1782):
Mind, we ask no money—only rags—mere literal rags—patience is a ragged virtue—therefore strip the girls, dear M—————, strip them of what they can spare—a few superfluous worn-out garments—but leave them pity—benevolence—the charities—goodness of heart—love—and the blessings of yours truly with affection, or something very like it, —I. Sancho
Likewise, from letter of March 30, 1787, to Mr. John Nichols, in Bibliotheca Topographica Britannica, No. 45 (1787):
Such are the trifling memorabilia, which I have been able to add to the more important communications the publick have already been indulged with from abler hands. The probability that within a very few years the church and town will become a prey to the fury of the waves, fully justifies what is now submitted to its inspection, however insignificant, by Yours truly, John Pridden.
And from letter of February 19, 1834, in The Crisis (March 22, 1834):
That the workmen may be firm, wise, and determined ; yet moderate, just, and charitable, is the earnest wish, the ardent desire, the sincere prayer, of him, who, though not a producer, is a working distributor, and who subscribes himself as yours truly, to serve in the cause of oppressed and enslaved industry, X. W.
And from letter of ~March 4, 1835, in Substance of, and Extracts from the Evidence Taken Before the Committee Appointed to Examine and Report upon the Ipswich Election Petition (1835):
Cowell watched P———— out of Connould's house and followed him to Bacon's Bank, where Mr. Kelly was standing and where P———— joined him. I hope the evidence of the petitioners will close tomorrow, but you must not return yet nor till you hear from Yours truly, in haste, JOHN CLIPPERTON
In his comment attached to the OP's question (above), Frank provides a link to a crucial early instance where "yours truly" appears not in the final sentence of a letter but somewhat earlier in a postscript. It occurs in a letter annexed to Document No. 46, in Documents of the House of Representatives, at the First Session of the Twenty-Fifth Congress (1837):
P.S. Please not to forget to give my wife or my brother the papers I asked you for, and oblige yours truly. You shall hear from me again. Yours truly, N. STEELE.
As Frank indicates, the meaning of the first "yours truly" in this example is clearly "me," though the writer may have been strongly influenced in his word choice by the standard formalities of letter writing. The next question, then, is when did people begin using "yours truly" outside the context of a letter? According to Farmer & Henley, Slang and Its Analogues Past and Present, volume 7 (1904), such usage existed by 1866, when Wilkie Collins used it in his novel Armadale:
YOURS TRULY, phr. (common).—A jocular mode of reference to oneself : cf. NIBS and WATCH. 1866. Collins, Armadale, 11, 168. Yours truly, sir, has an eye for a fine woman and a fine horse. 1899. Kettle[actually Charles Hyne], [A Master of Fortune: Being the] Furth[er] Adv[entures of Captain Kettle], ix. You may take it as straight from yours truly that you'll go to your own funeral if trouble starts.
Here is a fuller presentation of the Armadale instance:
"Might I ask, Mr. Armadale, which way your business takes you? Toward Bayswater? Would you mind dropping me in the Park? It's a habit of mine when I'm in London to air myself among the aristocracy. Yours truly, sir, has an eye for a fine woman and a fine horse ; and when he's in Hyde Park he's quite in his native element." Thus the all-accomplished Pedgift ran on ; and by these little arts did he recommend himself to the good opinion of his client.
And here is a longer look at the Kettle instance:
"You've friends in this town," he [Kettle] said, "and I dare say you'll have a goodish bit of power in your small way. I've neither, and I don't deny that if you bring up all your local army to interfere, I may have a toughish fight of it; but whatever happens to me in the long run, you may take it as straight from yours truly that you'll go to your own funeral if trouble starts. So put that in your hookah and smoke it, tintacks, and give me the other tube."
I didn't find any instances (excluding letters) earlier than Armadale where "yours truly" clearly seems to mean "me." However, I found a number that were earlier than the Captain Kettle instance. One unusual instance from 1847 involves a character named Yours Truly. N. P. Willis, "Supper After the Opera" in Dashes at Life With a Free Pencil (1847) presents a vignette involving three speaking characters: Brigadier, Flagg, and Yours Truly. The author sets the scene thus:
Private room over the Mirror office, corner of Ann and Nasau—Supper on the round table, and brigadier mixing summat and water—Flagg, the artist, fatiguing the salad with a paper-folder—Devil in waiting—Quarter past ten, and enter "Yours Truly" from the opera.
From Old Calabar, "The Dead Heat," in Baily's Monthly Magazine (February 1870):
'The horse will leave by the late train to-night for England with a lad ; so no one will be a bit the wiser. My old stud groom will come to your diggings this evening to give you a help. So au revoir till mess time, when you will see yours truly,' and putting his horse at a five-foot wall, he sent him over, hurling the loose stones behind him in a cloud, and was quickly out of sight.
From Justin McCarthy, "Donna Quixote," serialized in Belgravia (June 1879):
There was something uncomfortable, uncanny about the woman [Paulina] which made her companionship more oppressive to Gabrielle than any mere lack of education or good manners could have done.
'Had I not better write a line to Mr. Fielding, and ask him to come and see you, Paulina?' Gabrielle asked. They two were alone. ' He will wish to see you, and you will like to see him.'
' Law, Gabrielle, send for him as soon as you like, if it's any ease to your mind, my dear ; if you don't feel quite sure about yours truly, Fielding will soon give you satisfaction on that point. He can't deny that I am myself, anyhow; he can't say that this girl isn't the wife of Philip Vanthorpe. But don't send for him on my account, I beg of you, nor on his, my dear. We don't particularly want to see each other, I can tell you.'
From George M. Baker, The Flowing Bowl (1885) [the second instance of "yours truly" in this excerpt seems to mean (in the old-fashioned sense, and in contrast to the first instance's meaning) "truly yours"]:
Jessie. Any friend of Mr. Jerome—
Charlie. Is yours truly. (Offers hand.) Put it there. (Jessie, shrinking, places her hand in his.) Don't be skeered, gal : I'm as gentle as a calf here, but out thar rile me, an I'm a tearer. That's me.
Charlie (taking position at table at corner nearest Jessie, as before). Mean business, that's me. I'm roaring Carlos of the prairie. I'm a dead shot, a boss horseman, and a sure slinger of the lasso. I've a big ranch, a big herd of cattle, and a big heart, all of which is yours truly. Now short, sweet, and to the pint : when will you marry me?
From Ernest Favenc, "The Hut-Keeper and the Cattle-Stealer," in Tales of the Austral Tropics (1893):
"I give you my word, boys, he's out at Murderer's Camp now, shaking in his shoes and praying that all hands and the cook up above will take pity on the soul of yours truly."
"How did you fix him?" said one.
"With a painted mark round my neck and my own devil's humour. It was the greatest fun out."
From Paul Ford, The Honorable Peter Stirling (1894):
"Mr. Pierce, chum," replied Watts, with a look in his eyes which Peter had learned to associate with mischief on Watts's part, "has too great an affection for yours truly to object to anything I do. Do you suppose, if I hadn't been sure of my footing at the Shrubberies, that I should have dared to ask an invitation for:—then Watts hesitated for a moment, seeing a half-surprised, half-anxious look come into Peter's face, "for myself?" he continued.
To sum up, the use of "yours truly" as a kind of jocular self-reference—and not merely as part of a formal way to close a letter—seems to have occurred in the middle of the 19th century. In most of the earliest instances where the phrase appears in print in non-epistolary contexts, authors put it in the mouths of unrefined or indeed uncouth characters, implying that the usage arose out of a misunderstanding by unschooled (or marginally schooled) individuals as to its proper meaning at the end of a letter.