Authority in the cockpit, especially in emergency, is very important in a principle called Crew Resource Managment, or CRM. A number of incidents similar to your example led to the formulation of this concept to enhance the coordination between the crew. The idea is that all crew members should be working together as effectively as possible to solve the problems at hand.
In emergencies, the crew need to be able to communicate. This means that the first officer should be willing to question the Captain, like they did in your example. They should also be willing to take action if they feel it necessary. However, communicating this action is also important, as evidenced in the crash of Air France 447, where the pilots were commanding different inputs.
Neither of the pilots should be ordering the other to do anything unless absolutely necessary. They need to get the attention of the other pilot, state the problem, say why it's a problem, and suggest a solution to the problem. Then they need to agree on a plan of action, and be clear about who is in control.
In your example, the captain's negative attitude may have prevented the first officer from saying anything more. A better response from the first officer would have been to say something more along the lines of, "Sir, we are flying towards high terrain, we are not flying high enough to clear it. We need to either climb over it or turn left to avoid it. Do you agree?" This makes it clear to the captain what problem the first officer sees, and is clear about how the first officer thinks they should respond. It also includes a direct question for the captain to answer. Both pilots should be ready to communicate like this if necessary, and should also be making sure that they aren't creating an environment where the other pilot isn't comfortable with doing so. If the first officer still got no response, he should have been willing to take control, and should communicate to the captain that he is doing so, including the previously stated information about what actions he intends to take.