First of all, it's the food. From my experience, if the food is really good, then other factors will tend to "fit". I think the reason is that good food is harder to provide, whereas good service, nice atmosphere etc. are comparatively easier to provide. I also feel that if a restaurant is meticulous where food is concerned, it will be just as meticulous where service or atmosphere are concerned.
the next important factor for me is the atmosphere in the restaurant. the atmosphere can be very much influenced by the service I get, but it's also a function of the lighting, the music, the decoration, the design of the tables, etc.
The service is the least important factor from the three you've mentioned. If the food is good and the atmosphere is comfortable, no lousy waiter can stop me from enjoying myself. In such cases, the lousy service can actually become a subject of amusing conversation around the table. Furthemore, I believe that if I get a lousy service in a restaurant (especially if the food and atmosphere are good), it can be attributed, most of the times, to a unique set of circumstances that I had the bad luck of encountering, and not to a low standard of the restaurant.