Sentence in question:
It was for the boys' father's birthday.
This is a valid sentence. It refers to the birthday of a father that has more than one boy. The birthday belongs to the father, the father is relative to the 2+ boys.
The first apostrophe should be earlier (boy's) if there is only one boy. The second apostrophe should be later (fathers') if there is more than one father, but then you would (probably) be referring to more than one birthday (birthdays).
If you wanted something less ambiguous, don't string it together that way. While I don't consider it ambiguous, I might consider it awkward. Try this alternative on for size:
It was for the birthday of the boys' father.