The song was originally released in 1931, while in the Star Trek universe it was apparently released earlier. The original recording featured the voice of Bing Crosby; Dean Martin recorded a version of the song in 1958.
Due to copyright issues, the original Ray Noble recording of "Goodnight Sweetheart" was replaced during the 1980s by another version for VHS and Laserdisc releases. However, Paramount's 1980 "Television Classics" home video release of this episode retains the original recording. Eventually this was corrected for the DVD release. New music was also composed for this episode, incorporating the song by Fred Steiner, but the composer is not credited in the end credits. (X)