The Cowboys were largely their own worst enemies through the first three quarters, but rallied in the fourth to come away with a 27-23 win over the lowly Texans.