If there is any slack available, pull in an inch or two, strip 1/2 inch or so from each wire, slide a piece of heat-shrink tubing over one wire, and solder the two wires together (rosin core solder or rosin flux - no acid flux). Slide the heat-shrink tube over the joint and shrink it.
This is NOT code with 120 volt wiring, but is just fine with t-stat wiring.