The answer appears to be well known: it first appears in William Mountfort's 1705 play Zelmane as:
"Ha! hold my Brain; be still my beating Heart."
but this is generally repeated without demonstrable citation. However, while Google Books couldn't even get a preview, a plain Google finds the e-text at the University of Virginia Library: Zelmane: Or, the Corinthian Queen. A tragedy.
The phrase was in full swing by the early 1800s, but trying to back-track, the best Google Books could manage was 1774, in a poem in the Lady's and gentleman's diary.
Be still my beating heart! she may return -
Still may return to bless her Damon's eyes;
Return my fair, thy shepherd still is true;
True to those mutual vows, those plighted ties
I can't hack the title for sure at this instant, but it might be The Deserted Swain, by Mrs Blanch Lean, near Redruth. A definite full-view hit, though, for John Hoole's 1775 Cleonice, princess of Bithynia: a tragedy. As it is performed at the Theatre Royal in Covent-Garden.
Be still my beating heart! - O Cleonice!
I feel her now - instruct me every God
In sooothing speech - O! Teach my lips to breathe
In gentlest sounds the fatal word - farewell
- Act 1, Scene 1, Cleonice, John Hoole, 1775
Did people really enjoy this kind of play? Apparently they didn't, and its nine-day run bombed, not helped by an attack of preciousness among the cast.
From the London Review for March 1775 and the European Magazine for March 1792 we gather, that Cleonice was at first rejected by the managers of Covent Garden Theatre. Being doubtful, however, of their own judgment, they referred the matter to Dr. Johnson, who approved of the play, and on the 19th. Dec. 1774 returned it to Hoole with a few complimentary lines.
"Cleonice'' was accepted accordingly and "put in rehearsal, but Mrs. Barry refusing to perform the part of Cleonice, it was given to Mrs. Hartley. Mr. Barry rejecting the part of Lycomedes intended for him, took a subordinate character, and even that he relinquished on the 2nd. night. The Play thus left to itself, without either of the popular Actors, languished out the nine nights, and from that time Mr. Hoole bid adieu to the Stage." Hoole proved his noble character on this occasion by returning a considerable part of the money which he had received for the copyright, alleging, that, as the piece was not successful on the stage, it could not be very profitable to the bookseller, and ought not to be a loss.
- John Hoole, his life and his tragedies, Sägesser, Arthur, Pub. Bern, J. Fischer-Lehmann, 1917
It might have been taken more seriously if Hoole hadn't called two major characters Arsetes and Arsinoe, a detail I'm sure was not lost on the abbreviator of character names for the 1797 Bell's British Theatre edition.
Addendum: Trevor at Kalebeul (see Comments) has just pointed out that we get more hits in the required time slot by searching on "ftill my beating heart", as Google Books doesn't yet recognise the archaic "long s" as "s". Neat: a wrinkle to remember. I see Mr Hoole recycled, as he used exactly the same phrase in his translation of the works of the poet Metastasio. 1
1. No accident that this looks like "metastasis". As explained in a footnote in Vernon Hyde Minor's The death of the baroque and the rhetoric of good taste, it's a Hellenised nickname based on the poet's real surname, Trapassi (which means in Italian "to pass from one place to another" - as is the etymology of "metastasis").