Every unfair dismissal case turns on its particular facts - no firm advice can be given without looking at the details. However, as a general rule, you risk losing your job if you refuse to carry out a legitimate and reasonable instruction given to you by your employer. So a tribunal would first of all look at the instruction.
The dismissal would probably be unfair if the instruction was that you break the law, e.g. drive faster than the speed limit, or enter false accounting records. It is unlawful for your employer to instruct you to discriminate against someone, for example because of their race, sex, disability, sexual orientation or religion or belief. If you are sacked for refusing to carry out an instruction to discriminate, an employment tribunal would probably find this an unfair dismissal.
It might also be unfair if the instruction, although legal, was beyond your contract and clearly unreasonable.
If the instruction is lawful and reasonable, but of minor importance and the refusal was your first offence, the tribunal might decide your refusal was not gross misconduct. However if the instruction is repeated but you still refuse, that could well result in a fair dismissal.
Tribunals will also take into account, where it is relevant, whether your colleagues were prepared to obey the order.
You can refuse to work in conditions of serious and imminent danger, provided you cannot find another way of averting the risk.