I currently credit Nathaniel Hawthorne with two literary first uses. His 1843 sketch "The Old Apple-Dealer" is, to my knowledge, the first literary mention of the railroad, while the 1851 The House of the Seven Gables introduces photography to literature via a daguerreotypist.
Come to think of it, there's another - "The Old Apple-Dealer" is merely set in a railroad station. The first literary train ride is from just slightly later in 1843, in "The Celestial Railroad," Hawthorne's clever update of The Pilgrim's Progress. Turns out you can't just ride the train to Heaven.
Maybe I should mention that I don't actually quite exactly think these works are really the first mentions of these subjects in all of fiction, not to mention poetry, not to mention other belletristic essays and whatnot. The world, it is big. But if you know of an earlier candidate, please put it in the comments. If it's a daguerreotypist or other photographer, earlier or later, please add it to Terry Vertigo's bibliography of fictional photographers, as well. He's got a 100 year gap between Hawthorne and Anthony Powell that needs filling.
And I have a larger point, which is that I never think of Nathaniel Hawthorne as Mr. Up-to-the-minute, keen observer of what's new and now. Dickens and Balzac, for example, those are the eagle-eyed journalists of the big picture. But Dickens doesn't put a character on a train until Chapter 20 of Dombey and Son, published in 1846 or 1847, (oops, untrue - see correction below)* and his first mention of the subject is earlier in the same novel. Oddly, Dickens has to have someone build the railroad, in Chapter 6, before any of his characters can ride on it, an unusually literal way of constructing a fictional world. See nicole's post here for a really fine passage from that chapter.
I don't remember Balzac using the word "railroad" until Cousin Bette, 1846, and then it always has the word "bond" after it. The context is always investing. No one actually sets foot on a train. Maybe somewhere in the sixty plus installments of The Human Comedy I have not read there is a daguerreotypist or a train ride or two, maybe even one earlier than Hawthorne's. Although railroad construction started late in France for various reasons, not until 1842 on any significant scale, so Hawthorne probably trumps Balzac there.
The House of the Seven Gables actually devotes a paragraph to the issue of technological novelties. Clifford has been in prison for decades, so everything is new to him:
"As regarded novelties (among which cabs and omnibuses were to be reckoned), his mind appeared to have lost its proper gripe and retentiveness. Twice or thrice, for example, during the sunny hours of the day, a water-cart went along by the Pyncheon House, leaving a broad wake of moistened earth, instead of the white dust that had risen at a lady's lightest footfall; it was like a summer shower, which the city authorities had caught and tamed, and compelled it into the commonest routine of their convenience. With the water-cart Clifford could never grow familiar; it always affected him with just the same surprise as at first." (Ch. XI)
This is followed by a bit about, yes, railroads, "the obstreperous howl of the steam-devil." Much of Hawthorne's work, much of his imaginative life, takes place in the colonial history of New England. But there's this other side of Hawthorne that didn't fit my image of him.
* UPDATE: I forgot about the short American train ride in Martin Chuzzlewit, Chapter 21, another fine scene for the reader with a taste for Dickens' America fantasia. This chapter came out in serial form in September 1843, so it's quite close to Hawthorne. But "The Old Apple-Dealer" was published in January 1843, and "The Celestial Railroad" in May 1843. Check my work here. Thank goodness my error didn't spoil my Dombey and Son joke. The Americans can build their own railroads; Dickens has to build the English ones himself.