Early instances of metaphorical 'light at the end of the tunnel' from newspapers
Newspaper database searches turn up instances in which "light at the end of the tunnel" is used in a literal sense going back to the 1850s. But the earliest figurative sense of the term appears to be this one, from "The Woman Who Was Done," in the St. Louis [Missouri] Republic (July 13 1902):
"Oh, that [Ima Spunge] isn't her real name, but we—the girl who shares the apartment with me and I—call her that. Coz why—she is such a dreadful little sponger. I shan't tell you who she is, for it would be unkind—you might recognize her. But she always leaves me absolutely prostrated after one of her calls. And so we have likewise dubbed the illness which ensues parasitus."
"I begin to have glimmerings of light at the end of the tunnel of mental darkness you've been dragging me through. So she is a parasite?—a kind of pretty, hideous human orchid, feeding on other people. I know one or two myself."
From Father O'Reilly, "St. John's College Appeal," in The Catholic Press, an Australian newspaper (February 24, 1916):
As to the students' library, I am at last able to see light at the end of the tunnel. The Right Rev. Dr. Carroll, Bishop of Lismore, has very generously promised one hundred pounds. And I have received donations of £5 each from the following The Sacred Heart Nuns, Rose Bay; the Sacred Heart pupils, Rose Bay; "a Sydney priest;" Miss Hally, Turramurra; Mster Dick Honnor, Junee; Mr. Neil Macdonald, Neutral Bay. In all, between cash and promises to date, I have rceived for the library £380 out o the £500, which was estimated as needful to make an effective beginning.
And from a letter to the editor of the New Ulm [Minnesota] Review (March 7, 1917), from A.G. Wagner of Kiesling, Washington:
So the day seems to be dawning upon which more people will discern that instead of condemnation and denunciation of those who differ from us, is about to be relegated to the rear and a more wholesome and a more sane concept is to prevail with which the inherent decency and kindly human spirit will manifest unshackled and unrestricted for the peace and happiness of all. "Love's struggle throughout the ages" yet continues, but "there's light at the end of the tunnel," I feel.
This last example is interesting because it puts the "light at the end of the tunnel" saying in quotation marks, as though it were a recognized idiomatic phrase.
Early instances of metaphorical 'light at the end of the tunnel' from other sources
A Hathi Trust search for "light at the end of the tunnel," used in a metaphorical sense, yields several additional early matches.
From "Trusting God in the Dark," in Theodore Cuyler, God's Light on Dark Clouds (1882):
Sometimes we have an experience in life that seems like walking through a long dark tunnel. The chilling air and the thick darkness make it hard walking, and the constant wonder is why we are compelled to tread so gloomy a path, while others are in the open day of health and happiness. We can only fix our eyes on the bright light at the end of the tunnel, and we comfort ourselves with the thought that every step we take brings us nearer to the joy and the rest that lie at the end of the way.
Cuyler, who was English, wrote this extremely popular book following the death of his daughter during a typhoid epidemic. The book went through at least seven editions in 1882 alone. I suspect that this instance of "light at the end of the tunnel" is the one that Etymology online cites as the earliest known occurrence of the expression used in a metaphorical sense.
From the Marquess of Bute, "On the Ethnology of the Welsh Race," presidential address delivered at the National Eistereddfod, on August 6, 1883, reprinted in Y Cymmrodor (October 1883):
The progress of science in this, as in many other respects, has, I suspect, brought us within sight of daybreak—perhaps I should use a more fitting comparison if I said, shown us the light at the end of the tunnel. Indeed, I may venture to say that a recent instance of stupidity, in which a legislative enactment believed (I say not whether believed rightly or wrongly) to be applicable to the rest of Wales was believed to be inapplicable to Monmouthshire, is, as far as I know, one for which few matches could be found within the last mil[l]ennium.
From a review of Francis Knight's The Rambles of a Dominie, in The Saturday Review of Politics, Literature, Science, and Art (July 18, 1891):
There is a simple recipe for the kind of writing that makes up The Rambles of a Dominie. You think of a subject which can be pleasantly treated in about eighteen hundred words. That limit of space is the primary condition, and we feel the jar of it in the alternate abruptness and long-windedness of each closing sentence. "In an Apple Country" will do as well as any other theme for the nonce. You sentimentalize about autumn in the abstract (200 words), about autumn in Somersetshire (150 words), and about the "orchard-lawns" of Avilion (50 words). This rather below the mark, so you hurry on to the apple-crop (100 words) and "the story of an apple-orchard" (500 words), throwing in the cricket—that "musician of autumn"—wasps, and the "unnumbered hosts of other insects" (400 words). You now see light at the end of the tunnel, and a vigorous attack on the hibernation of these insects (250 words) prepares for a final burst on winters of unusual severity (150 words), and the thing is done before you know where you are.
From From Victory to Victory, or, Canadian Conquests, 1894 (1894):
The circulation of the War Cry has been another item causing considerable perplexity, but with coming of our new Editor from far-distant Australia, we see fresh light at the end of the tunnel.
From "News Notes" in The Bookman (April 1902):
Mr. William Stead, son of Mr. W. T. Stead, is assisting Mr. John Morley with his life of Gladstone in a secretarial capacity. It is still uncertain when the biography will be published, but Mr. Morley says that he now discerns a glimpse of light at the end of the tunnel.
From Elbert Hubbard, The Philistine (July 1905):
But with the supremacy of science, the introduction of the one-piece system in business, and the gradually growing conviction that honesty is man's most valuable asset, we behold light at the end of the tunnel.
The sources of these first five metaphorical instances of "light at the end of the tunnel" are thus as follows: England (1882), Wales (1883), England (1891), Canada (1894), England (1902), United States (1905). From this record, It seems highly likely that the metaphorical sense of the expression originated in Britain, and that Theodore Cuyler deserves credit for popularizing it (and perhaps originating it).
Later instances that may have helped popularize the expression in the US
One later but potentially very important instance of the phrase "the light at the end of the tunnel" in Google Books search results (with regard to popularizing it) is in a paper, "The American Proposal for International Control," presented by Bernard Baruch, and reported in Bulletin of the Atomic Scientists (July 1, 1946):
All of us are consecrated to making an end of gloom and hopelessness. It will not be an easy job. The way is long and thorny, but supremely worth traveling. All of us want to stand erect, with our faces to the sun, instead of being forced to burrow into the earth like rats.
The pattern of salvation must be worked out for all.
The light at the end of the tunnel is dim, but our path seems to grow brighter as we actually begin our journey. We cannot yet light the way to the end. However, we hope the suggestions of my government will be illuminating.
Baruch then went on to quote Abraham Lincoln to the effect that "The fiery trial through which we are passing will light us down in honor or dishonor to the latest generation." Baruch's remarks were evidently widely repeated and discussed. Three years later, as reported in "The Great Inquiry: Testimony at AEC Hearings," in Bulletin of the Atomic Scientists (August–September 1949), David Lilienthal (chairman of the Atomic Energy Commission) offered these remarks in testimony at a senate hearing:
On the 14th of June, 1946, Bernard Baruch, in one of the great state papers of all time, summarized where mankind stood: "The light at the end of the tunnel is dim, but our path seems to grow brighter as we actually begin our journey."
In April of 1947, when the Commission began its work, that dim light at the end of the tunnel was so dim as to be no light at all.
Russia, an Russia only, among the great nations of the earth, has been unwilling to take those steps which might make that dim light brighter.
Baruch's statement of hope about the dim the light at the end of the dangerous tunnel of atomic power (and the development of nuclear weaponry) may have led to widespread use of the saying, including (very famously) U.S. General William Westmoreland's use of the phrase in November 1967 in the context of Vietnam, and less famously (but earlier) in Lyndon Johnson's statement in 1966 to the same effect:
I urge you to remember that Americans often grow impatient when they cannot see light at the end of the tunnel—when policies do not overnight usher in a new order. But politics is not magic. And when some of our fellow citizens despair of the tedium and time necessary to bring change—as, for example, in Viet Nam today‚they are forgetting our own history.