Question: I have this question: since the CMO on board a starship is generally the captain's own private physician, is there anything in the regulations that says a CMO can't call the captain by his real first name in certain instances? Like when the captain feels stressed, or is afraid about something?

I"m not talking about meeting him/her in a bar or on the street and saying "Hello...." But when they're on duty and there are times when the captain's first name is used.

I understand that some would answer that for the CMO to call the captain by their first name should only come after they've developed a lot of trust over the years, but I contend that sometimes the CMO has that prerogative to call the captain, or even a crewman, by his/her first name during a medical procedure or when they're alone and the person wants to talk to him privately about a medical issue..

Answer: 
In most cases, the medical staff on a starship are outside the chain of command as they are specialists with their own command structure headed by Star Fleet's Surgeon General. In some cases, medical officers can take command courses if they wish (both Deanna Troi and Beverly Crusher do so at one point if I remember correctly). The CMO is generally considered to be the Captain's peer as he or she would be the only officer that is not considered to be wholly under the captain's command since the CMO does have the legal authority and duty to relieve the captain if he or she becomes physically or mentally unable to perform his or her duties. 

Whether or not the CMO addresses the captain by their first name would be up to the individuals involved. Kirk was more intimate with his senior officers and tended to be more informal, not to mention he had a much smaller crew (465 including 75 officers) while Picard was more traditional and formal. Picard almost never used anyone's given name and usually referred to his CMO as "Doctor". Picard also had a much larger crew requiring a greater degree of formality to ensure discipline was maintained (Enterprise D had a total crew of 1014 including 310 officers excluding the civilian family members which brought the total number on board to around 3000 if I remember correctly).
I think the answer is in the respective ranks.

As CMO, the doctor is usually a captain in their own right.

This is a command safety procedure.

The CMO has the right, even the duty, to place the captain on administrative leave if he/she deems it necessary.

This is a current naval safety procedure.

Therefore, unless speaking to the captain in his official capacity, the CMO does not need to use his/her rank.

Keep also in mind the limits on propriety.