There is an interesting story at the bottom of Chagiga 4b, top of 5a.
The Angel of Death is telling a Rabbi of an incident that happened.
The AoD has an assistant. The AoD tells him to reap Miriam A but he accidentally reaps Miriam B instead. The assistant asks if he should rectify the mistake by exchanging the two but AoD says not to. The unspent years allotted to Miriam B are given to a talmid chacham who will generate mitzvos for Miriam B but Miriam B does not enter the afterlife proper. She just sort of hangs around with the AoD in limbo until her years run out.
I accept that this may be an allegory, but how is it theologically acceptable that this sort of "creative accounting" goes on at the expense of people in a universe where God meticulously decrees every year "who by fire, who by water etc?" It seems that the answer to "why do bad things happen to good people" is because God tends not to care sufficiently to stop them as he can retroactively resolve the injustice by giving people more schar (heavenly reward) at the end, like an omnipotent airline that gives you free passes to the airport lounge because they were able to not lose your baggage but did anyway. Does God believe that he can create suffering such as the death of Miriam B (Which was the fault of heaven and not a human actor) and just make up for it by awarding schar?
http://halakhah.com/pdf/moed/Chagigah.pdf Tosafos says that Miriam (probably Miriam A) was the mother of A Certain Person. Both Miriams are titled "Magdala" with different spellings.