The phrase, "heavens to Murgatroyd" has a fairly recent origin in 20th century American pop culture, having first been spoken by Bert Lahr in "Meet the People" (1944). It was later popularized by Snagglepuss in the "Yogi Bear Show."
The phrase is a play on the earlier and better known exclamation, "heavens to Betsy." It is unknown, however, who either Betsy or Murgatroyd actually were or if they ever existed.
That said, the name Murgatroyd (also spelt as Murgatroid and Mergatroid) is a real English surname dating back to 1371, when a Yorkshire constable took the name Johanus de Morgateroyde, meaning "John of the Moor Gate Royde."