You're not alone. I've done the same thing on both my 950 and Stratoliner. I had a bag full of extra gloves in my bags on the 950 and lost them when the lock failed.
Living here in Florida, my bike gets rained on a lot and the indentation of that lock mechanism is always filled up with water. This causes the same issue you described. WD-40 is good for displacing the water, but not so much for lubrication. I spray the WD-40 into the lock and then let the lid in the open position to let everything drain out. If its a damp day, I get my wife's hair dryer out and heat it up while upside down. Once it's dry, I use this liquid graphite stuff (made for locks) that I bought some time ago and lube up the lock. They don't stick anymore, but I got to do it a couple of times a year.
This is definitely one of those things that weren't thought out very well on Yamaha's part. I like that the bags open out, but not really thrilled where they lock.