Last dance for JJ and Amy as Scots war hero waltzes off from Strictly
The war veteran and TV presenter, 33, and his partner Amy Dowden performed their Charleston to Chitty Chitty Bang Bang.
They went up against reality TV star Jamie Laing and his partner Karen Hauer, who performed their jive to Everybody's Talking About Jamie, in the dance-off.
After the couples performed their routines again, the judges delivered their verdicts.
Craig Revel Horwood chose to save Laing, saying: "Well I think both couples danced to the best of their abilities and both couples upped their game considerably.
"But for me the best couple on the night that I would like to go through to semi-finals - Jamie and Karen."
Motsi Mabuse, who picked Edinburgh-born Chalmers to stay in the competition, said: "I actually think we saw two different dancing styles which both have their own qualities; both energetic, both so great at this dance-off - very difficult decision.
"I saw a little hiccup with one dance, so I'm saving JJ and Amy."
Casting the deciding vote, head judge Shirley Ballas chose Laing, saying: "Both couples lifted their game, I adored both performances very very much, and both couples made small mistakes, both couples.
"But on a more powerful and through difficulty of choreography and through sheer determination, I'm going to save Jamie."
When asked by Tess Daly about his time on the show, Chalmers said he was "unbelievably proud".
"I never thought I would make it this far, I've gotten half decent maybe at something which I had no clue about to begin with and I've enjoyed every second of it - it has just been an absolute blast," he said.
"It's just a privilege to be in this long."
Dowden told Chalmers, who was injured in a roadside blast in Afghanistan while serving with the Royal Marines in 2011, that it had been an "absolute honour" to be his partner and friend during the competition.
"He is, and everybody would agree, one of the world's most truest gentlemen," she said.
"I honestly believe from working with JJ over the last few months I've become a better person and I've learned so much."