The rule of thumb according to the Torah is that saving a life takes precedence over the Sabbath. This applies even if there is even the slightest doubt that the situation at hand, should it deteriorate, could lead to a danger to life. There are vast treatises that deal with all the intricacies of these laws, beginning with chapters of the classical Code of Jewish Law in the laws of Shabbos and Yom Kippur.
Some opinions hold that the reason life supersedes Shabbat is that it’s preferable to break one Shabbat in order that the person saved should be able to keep many further Shabbats. According to this opinion, if the person is certain to die right after Shabbat, there would be no allowance to break this one for him. The majority opinion, however, which is considered the law, is that life itself supersedes the Shabbat, whether or not the one being saved will ever keep another Shabbat. Even if the person has only minutes left to live we override Shabbat to perform whatever is necessary for his needs to make him comfortable and perhaps give him moments of life. This is because the Torah teaches us that life is so precious it supersedes the fulfillment of mitzvot, including the all-important mitzvah of Shabbos.
A venerable sage, R’ Chaim Soloveitchik, was well known for his stringency in this matter, and great scholars would be seen leaving his home Friday night, with torch in hand, on a mission from the Rabbi to take care of this or that sick individual. When once challenged about his leniency in the laws of Shabbos, he famously replied that “he is not lenient in the observance of Shabbos, rather he is stringent concerning even the slightest doubt concerning the danger to life.” (Pikuach nefesh). That statement of R’ Chaim shaped the worldview of Jewish law and continues to be the attitude of authorities until today.
We could spend months or even years delving into the intricacies of this matter, but I hope this provides you with the rule of thumb you requested. I encourage you to spend time studying the intricacies of these laws, will greatly enhance your fulfillment of Shabbos as well as provide tremendous insight into the profound wisdom of the Torah.
Rabbi Yerachmiel Fried