The race for the reliably deep-red district was unusually competitive, suggesting trouble ahead for Republicans.