In what circumstances is it better to act immorally than to act morally out of mere prudence?
Your question is loaded from the start. You also haven't defined, or proved, what "immorality" is. Yet no matter, I"ll give you "immorality" (assuming we agree on the definition of the word, which would seem the best starting place).
Yet if you was a time traveler and had the option of killing Hitler as a baby, or letting him live, what would you do?
Or if you hid some Jews, homosexuals and Jehovah's witnesses in your house/monastery, and the SS came knocking, would you lie or tell the truth?
In both cases to kill hitler, and to lie to save the "subhumans", is immoral in "Buddhist" terms, yet the context demands a differenent perspective that colours it.
Therefore assuming you wouldn't give up a gay man to the SS, you would lie due to the situation. Thus context defines, or at least influneces, morality (if it exists).