The Megillah relates that Mordechai instructed Esther to present herself before Achashveirosh in a desperate attempt to save the Jewish people. Until the news of Haman's decree, Esther had not been in the intimate company of Achashveirosh unless he had requested her presence; this time, however, she would present herself to him on her own accord. She was halachically permitted to do this because the survival of the Jewish people was at stake. (The rule of "yehareg v'al ya'avor" did not apply, as the Gemara in Sanhedrin 74b explains.) This concern was uppermost in Esther's mind as she advanced towards the throne room in silent prayer that Hashem would give her favor in the eyes of the evil king whose golden scepter dictated the fate of those who appeared before him unbidden.
The Gemara says that on her way, Esther passed the royal room of idol worship. At that moment, the Divine Presence that had accompanied her until now departed, and she suddenly felt alone and unprotected. Esther cried out, "My G-d, my G-d, why have You deserted me?" (Tehilim 22:2).
She said, "Perhaps You are judging me for a forbidden act done under duress (in order to save Your people) as if it was done willfully?"
“Or perhaps,” she continued, “You are upset with me for calling Achashveirosh a 'dog' ('hatzilah... mi'yad kelev yechidasi,' Tehillim 22:21)? If so, I shall make amends and call him a lion ('hoshi'eni mi'pi aryeh,' Tehillim 22:22)." Esther's reckoning succeeded. The Divine Presence returned to her and she approached the king with renewed confidence -- and Divine protection.
In what way did Esther sin by calling Achashveirosh a dog? Why did belittling the evil king cause the Shechinah to depart from her?
Moreover, how was calling Achashveirosh a dog related to her first concern, that perhaps Hashem was punishing her for an act she did out of compulsion?
Rav Yaakov Emden quotes his father, the Chacham Tzvi, who offers the following answer:
The Mishnah in Bava Metzia (93b) teaches that if a lion attacks sheep, the shepherd (who is a shomer sochar, a paid guardian) is exempt from damages because he is not expected to be able to repel a lion. Such an attack is considered an "ones," beyond the control of the shepherd. However, if the sheep are attacked by a dog, or even by several dogs, the shepherd is held liable for the damages because the attack is not considered an “ones.” It is within the capability of the shepherd to fend off dogs.
The words of Esther are now understood. Esther justified her action with the claim that she was “ones,” acting under duress. She then remembered that she had called Achashveirosh a dog in her prayer for salvation, a contradiction to her present claim for Divine amnesty. If Achashveirosh was considered like an attacking dog, then her act should not be considered an “ones," an act beyond her control, because the attack of a dog can easily be repelled as the Mishnah in Bava Metzia states. Hence, she immediately corrected her mistake and admitted that Achashveirosh was more than just a “dog.” It was far more appropriate to compare him to a lion; after all, his domain extended to vast distances and his power was virtually unlimited. Since Achashveirosh was a “lion,” his attack is considered an “ones” for which Esther should be vindicated.