In this situation you are.
"Brooks declined to argue with him, even though as a commissioned officer he outranked Thompson"
Realizing that the soldiers intended to murder the Vietnamese, Thompson landed his aircraft between them and the villagers. Thompson turned to Colburn and Andreotta and told them that if the Americans began shooting at the villagers or him, they should fire their M60 machine guns at the Americans: "Y'all cover me! If these bastards open up on me or these people, you open up on them. Promise me!" He then dismounted to confront the 2nd Platoon's leader, Stephen Brooks. Thompson told him he wanted help getting the peasants out of the bunker:
Thompson: Hey listen, hold your fire. I'm going to try to get these people out of this bunker. Just hold your men here.
Brooks: Yeah, we can help you get 'em out of that bunker - with a hand grenade!
Thompson: Just hold your men here. I think I can do better than that.
Brooks declined to argue with him, even though as a commissioned officer he outranked Thompson.
After coaxing the 11 Vietnamese out of the bunker, Thompson persuaded the pilots of the two UH-1 Huey gunships (Dan Millians and Brian Livingstone) flying as his escort to evacuate them. While Thompson was returning to base to refuel, Andreotta spotted movement in an irrigation ditch filled with approximately 100 bodies. The helicopter again landed and the men dismounted to search for survivors. After wading through the remains of the dead and dying men, women and children, Andreotta extracted a live boy. Thompson flew the survivor to the ARVN hospital in Quang Ngai.
I acknowledged what I referred to as the "hideous realities" of war, but has bad as that can be it still does not erase the existence of applicable, appropriate morality. Otherwise there is no difference between armies or between armies and gangs, or between armies and criminals.
So you are simply incorrect to state that there is no such thing as an "illegal order." In the most egregious case, as an example, an officer cannot take some men into a high school and order the students shot and raped at his pleasure. I bring that up to establish a conceptual baseline - that's an example of unquestionably "illegal orders."
From there, the application of unlawfulness ratchets up into war zones, and also into war scenarios. These military laws proscribing unlawful orders exist and always have existed - this fact is not subject to question. JAGs and other legal officers really, actually do have work, you know. Another example is the harsh treatment of prisoners in order to compel obedience or for interrogation purposes, versus the torture or killing of them out of after-action rage or contempt.
As to the actual exigencies of warfare, however, you are absolutely right about what might almost certainly happen if you disobeyed an order in combat. Reasonable, even lawful responses would range from writing you up, arresting you or even shooting you on the spot. However, that STILL does NOT mean that you are lawfully non-responsible for carrying out "unlawful" orders. Of course, if you tried, and were found wrong, you'd be convicted of insubordination at the very least.
Nevertheless, whether or not you were ever told when you were in the military, you actually were required to disobey a non-lawful order. Surviving that lawful disobedience however, or even getting a chance to explain your actions, is another thing.
So what? Duty = duty. A real hero would do the jail time with a smile.
American soldiers protect mothers and kids, they don't shoot them.