The title is a reference to an old Middle Eastern story: a Baghdad merchant sends his servant to the marketplace; the servant runs back home and explains that he was threatened by Death while at the market. The merchant sends the servant off to hide in Samarra, then goes to the market to talk to Death. Death explains that he had not threatened the servant - merely that Death was surprised to see the servant in Baghdad, "for we have an appointment tonight in Samarra."
The teddy bear in the little girl's hospital bed is an homage to the suicidal teddy who comes to life in Supernatural episode Wishful Thinking (2008).
Robert Englund guest stars in this episode. He is best known for playing Freddy Kruger in the A Nightmare on Elm Street (1984) series.
When the doctor opens the apartment door you can see the apartment number is 4. In Japan four is considered unlucky because the word for 4 in Japanese "shi" sounds similar to the word for death "shin".
When the heart-attack victim asks Dean what it all means, Dean quotes the Kansas song "Dust in the Wind" (1978), just like Ted does when "philosophizing" with Socrates in Bill & Ted's Excellent Adventure (1989).