Is Mark Twain's "Life on the Mississippi" the first to connect cursing and turning blue?
No. There are earlier examples:
The OED's earliest record is
P8. to turn (also make) the air blue: to swear profusely, to use obscene language (cf. sense A. 10b).
1867 Chronicle (Univ. Michigan) 9 Nov. 1/3 If a crowd of ‘roughs’ go careering through the streets at midnight, turning the air blue with curses.
10. colloquial. a. Coarse, obscene; (esp. of a joke, story, film, etc.) having sexual content, pornographic.
1818 ‘A. Burton’ Adventures Johnny Newcome 31 Blush, Pluto! Blush as brimstone blue! This bluer Town can boast like you A ‘facilis descensus’ too.