Only if you are the highest ranking officer assigned to the ship, or in other words its commanding officer. Not if you're just covering the bridge while the actual Captain is away. For example, no one on Voyager called Harry Kim "Captain Kim" when he was in charge of the night shift, nor were they supposed to.My understanding is that if you're in the center seat, so to speak, then it's appropriate to address you as Captain regardless of rank.
Actually, at the time Jadzia was the Defiant's permanent commanding officer since Sisko was reassigned to Admiral Ross's staff. This is an actual plot point in the episode Behind the Lines, the episode which includes the conversation between Nog and O'Brien everyone is quoting in this thread. There's an entire scene where Sisko and Admiral Ross discuss the fact the Defiant is no longer Sisko's command or responsibility in the episode.Exactly. Jadzia, for example, was not the permanent commanding officer of the Defiant, but we have seen her doing it, and she was still called Captain regardless of her rank.
Granted, a lot of this is undone because in the very next episode Sisko is reassigned command of the Defiant again so he can lead the mission to retake DS9, and from there everything returns to the status quo of Worf having regular command of the Defiant. However, had such mission never occurred, Dax would have continued to be the Defiant's CO for the foreseeable future. And thus why it is acceptable for her crew to call her "Captain."