What specific problem do you hypothesize is being caused by a bad USB socket solder joint?
I think it's highly unlikely it would cause corruption of the uploaded sketch in a manner that would allow the sketch upload to pass and the program to run well enough to produce the reported behavior, and surely wouldn't do this reproducibly after subsequent uploads.
I suppose a bad connection on a power line could cause it though.