We had the intermittent brakes happen on the trailer. Sometimes they would work, sometimes not. Ended up being the plug on the brake pedal had a broken wire in the connector. Changed the connector that plug into the pedal, everything worked. apparently it was a common thing on '05 gm's.