What you want to learn is how to "heave to." It is essentially like putting a boat in "park" with the sails up. How do you do this? Think of it like tacking except that you never release the
jib sheet for the tack. You keep the tiller or
wheel over as if you were continuing to turn the boat for the tack. By keeping the
jib sheeted over it provides an opposing force to the mainsail. The boat will stop head to wind and be pretty stable. You will eventually start to drift slightly but you'll be amazed out how much of relief it can be.
As for which sail to douse first, I would probably try to get the main down first. It will have the most surface area and be likely to force the boat to heel more than the
jib. This is also a good case for roller
furling! I have always been able to get my
jib furled quickly even in windy conditions!
Jon