The little black "clip" than snaps it into place isn't that big a deal, I really doubt it will wiggle out the back of the climate control.
I honestly have no idea what it plugs into. It's going to be something that controls all the blend doors in the cabin. You're likely going to have to pull the dash to see.
I'd honestly have a easier time believing that both the units are failing, instead of the harness being a problem.
Clean your grounds first, if they start acting up, no telling what they can screw up. Aside from the ones on the (-) terminal, and on the block/pass. head, there are several grounds on the intake manifold as well, in addition to several inside the cabin.