I had a similar issue last summer, and it drove me nuts; intermittent brake lights / turn signals / taillight / trans / cruise control issues, just random enough to stump me. Of course, the added junction box with the trailer wiring and the backup floods and LED turn and brake lights on the ladder rack added to the possible sources, so tracing the problem was nearly impossible. As it turned out, the grounds at the aft end of the truck weren't adequate (despite a new ground at the trailer j-box and a new ground strap from cab to frame to bed...) I ended up cutting off the taillight and backup light ground wires from the harness and now the grounds from the lamp sockets connect immediately to the bed via ring terminals and sheetmetal screws. WOW - the taillights are as bright as they oughta be, and all the various flashers, cruise control, etc. all work as intended. As an old friend said, when in doubt, check your grounds. Good luck.
Josh