The second earliest in-the-wild match (from 1832) that I found seems to play on the connection between blue from "blue devils" and blue from "turning blue" with cold. As for the place of origin of the phrase "feeling blue," it is striking that the earliest instances of "feeling blue" (from 1826), "feels blue" (from 1832), and "feel blue" (1835 ... More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.