I let Luke start sleeping with us when he was maybe 4-5 months old and he never had an accident. He was incredibly easy to potty train though, I think it really just depends on the individual dog. I use a baby gate to keep them in the bedroom at night so even if they did get up they can't really go anywhere.
@Roger and Laurie, I feel your pain lol. My two are such bed hogs and I'm a really light sleeper, so having two dogs in the bed definitely does affect my sleep.
My corgi is only 5 months, and I don't think she'll have that kind of freedom for another year or so. Our dachshund was a tough cookie. We tried crate training him, and it just didn't work. We let him sleep with us and I slept horribly. Eventually we trained him with the command "Go to your own bed" and when we say that he climbs out of our bed and burrows inside his own comforter on the floor beside our bed. I think it's the perfect solution for us. We all climb in bed for some down time (reading, watching tv, or playing on laptops), and when it's time to sleep we say the magic words and everyone goes to sleep in their own bed. He didn't learn this till he was almost 2. We have found that now he prefers to sleep in his own bed, and when he's done cuddling, he's done. You may find that since your corgi is crate trained that he prefers sleeping in is own bed over yours. Not all dogs sleep well in a crowded bed. I would wait til he's older to find out though.
We waited a little over a year before our first corgi started sleeping on the bed. It's amazing how those four little paws can push me over to the edge of the bed. He's never had an accident on the bed. The couple of times there's been an event during the night, he jumped down and went as close to the door as he could. Dogs do not want to soil where they sleep.
His 11 month younger brother started sleeping on the bed at about six months. Smart little guy admiringly learned everything from his brother and we've never had a problem.