This is the exact thing what happened to me couple of months back. I got an offer from A, accepted it, then got the offer from B, and it was absolutely what I wanted at that point. I was initially having a lot of doubts about the 'saying yes and then backing off' thing. But then the thought struck that, any company wants 100% from their employess. If I am forever thinking about what could have happened, I wouldnt be very happy at al. So I called up the HR of company A, told him some reason for not joining (didnt mention company B), apologised for it, explained the situation to the consultant who was the middleman. After clearing my conscience, I finally called up company B and took up their job. The whole thing took less than 4 hours of serious thenking, and I have never regretted it