The Cork Leg appears in William Evans Burton's 1837 Burton's Comic Songster (pp12-13) credited as "Written by Mr. Hudson, expressly for Mr. Burton". Its first US publication appears to be a broadsheet by Hudson, The cork leg,and Oyster maid (see Yale University Library Catalogue) published in Boston in 1832. There were also British versions circulating, uncredited, around the same time: the Bodleian Harding collection's Harding B 11(3925) manuscript has one published by a J Catnach, London, between 1813 and 1838.
In a story somewhere between The Red Shoes and The Wrong Trousers, it tells of:
... Mynheer Von Flam,
Who every morning said "I am
The richest merchant in Rotterdam."
who has his leg amputated after breaking it, and replaced with an artificial one:
An artist in Rotterdam, it should seem,
Had made cork legs his study and theme,
Each joint was as strong as an iron beam,
And the springs were a compound of clock-work and
The leg, however, goes Horribly Wrong.
He walk'd through each square, and he pass'd each shop,
Of speed he went at the utmost top,
He went with a bounce, and a jump, and a hop,
When he found his leg he could not stop.
Horror and grief were in his face,
The neighbours thought he was running a race,
He clung to a lamp-post to stop his pace,
But the leg kept on nor gave up the chace.
He walk'd of days and nights a score,
Of Europe soon he made the tour,
He died, and though he was no more,
His leg kept on the same as before.
The leg-maker grumbles and loudly swears,
That of his bill he'll increase the amount,
But for all this the leg never cares,
But still keeps up a running account.
I've told my story fair and free,
Of the funniest man I ever did see,
He never was buried, though dead he be,
And I am now singing his L E G.
Googling "steam leg" finds a number of contemporary references to the song. However, it also finds something different: this allusion by Thomas De Quincey to a different and earlier work.
... thence doubling back upon London, like the steam leg in Mr H. G. Bell's admirable story.
- page 285, De Quincey's Works, 1853
HG Bell was the Scottish lawyer, poet and historian Henry Glassford Bell (1803–1874), and the reference tracks to his 1832 anthology My Old Portfolio; or Tales and Sketches and the story "The marvellous history of Mynheer von Wodenblock" (pp83-94). First published in the Edinburgh Literary Journal, 47 (1829), this erudite and literate story tells how a wealthy Rotterdam merchant, Wodenblock, is fitted with a complex prosthetic cork leg by the instrument-maker Turningvort. Its power source isn't explained - it's described as containing "wheels within wheels" and "springs acting upon springs". However, it proves unstoppable, with horrific outcome.
Leyden is more than twenty miles from Rotterdam, but the sun had not yet set, when the Misses Backsneider, who were sitting at their parlour window, immediately opposite the "Golden Lion," drinking tea, and nodding to their friends as they passed, saw some one coming at furious speed along the street. His face was pale as ashes, and he gasped fearfully for breath; but, without turning either to the right or the left, he hurried by at the same rapid state, and was out of sight almost before they had time to exclaim, " Good gracious ! was not that Mynheer Von Wodenblock, the rich merchant of Rotterdam.
Next day was Sunday. The inhabitants of Haarlem were all going to church, in their best attire, to say their prayers, and hear their great organ, when a being rushed across the market-place like an animated corpse, —white, blue, cold, and speechless, his eyes fixed, bis lips livid, his teeth set, and his hands clenched. Every one cleared away for it in silent horror; and there was not a person in Haarlem, who did not believe it a dead body endowed with the power of motion.
On it went through village and town, towards the great wilds and forests of Germany. Weeks, months years, past on, but at intervals the horrible shape was seen, and still continues to be seen, in various parts of the north of Europe. The clothes however, which he who was once Mynheer Von Wodenblock used to wear, have all mouldered away ; the flesh, too, has fallen from his bones and he is now a skeleton—a skeleton in all but the cork leg, which still, in its original rotundity and size, continues attached to the spectral form, a perpetuum mobile, dragging the wearied bones for ever and for ever over the earth!
May all good saints protect us from broken legs! and may there never again appear a mechanician like Turningvort to supply us with cork substitutes of so awful and mysterious a power!
Given the uncertainty of chronology of British publication, it's unclear if the The Cork Leg is a rehash by Hudson of Bell's 1829 story, or if Bell wrote up the broadsheet as a story; either way, the unfortunate Mynheer von Wodenblock definitely pre-dates the 1834-35 The Steam Arm as an example of a cyborg in fiction.
Henry Glassford Bell looks worth reading. My Old Portfolio; or Tales and SketchesThe marvellous history of Mynheer von Wodenblock, they include The dead daughter (highly reminiscent of Poe's Ligeia with its tale of a family's new daughter who grows up identical to the one who died); The living mummy, and the Leyden professor (about a professor who finds a skinny merchant to be a suitable candidate as a mummy for his museum); The Wreck of a World, a Day-Dream (a vivid apocalyptic fantasy); A Tale of the Sea (about a passenger stranded aboard a drifting ship after waking to find the whole crew has decamped); and Dicky Cross, the idiot of Exeter (in which a young woman, taking a short cut through Exeter Cathedral, finds herself locked in with a murderous idiot).