‘Beating heart’ has long been used to denote breathless excitement. John Dryden used it with that meaning as early as 1697, in The works of Virgil:
“When from the Goal they start, The Youthful Charioteers with beating Heart, Rush to the Race.”
‘My beating heart’ was a stock expression for 18th century novelists and poets. It is first recorded in Nicholas Rowe’s Tamerlane, a tragedy, 1702:
“My beating Heart Bounds with exulting motion.”
The earliest citation of the full ‘be still, my beating heart’ comes from William Mountfort’s Zelmane, 1705:
“Ha! hold my Brain; be still my beating Heart.”
The expression, and the comic manner in which it is now delivered, were brought to a wide public in Gilbert and Sullivan’s opera HMS Pinafore, 1878:
Ralph:
Aye, even though Jove’s armoury were launched at the
head of the audacious mortal whose lips, unhallowed by
relationship, dared to breathe that precious word, yet would I
breathe it once, and then perchance be silent evermore.
Josephine, in one brief breath I will concentrate the hopes, the
doubts, the anxious fears of six weary months. Josephine, I am a
British sailor, and I love you!
Josephine:
Sir, this audacity!
(Aside.) Oh, my heart, my
beating heart!
(Aloud.) This unwarrantable presumption on the
part of a common sailor!