Ethics questions concerning a referee assignment
Publishing this result independently is questionable from an ethical perspective, especially because it sounds like: 

(1) you would not have been working on this problem without having read their manuscript as part of your refereeing duties;

(2) the result is your justification, but it is for their claim, which they thought of;

(3) you raised this issue in your referee report, and presumably the acceptance of their manuscript depends on addressing it (in other words, it is not just tangentially related to their work, but affects their publication in a significant way).

You clearly have not done anything unethical in thinking about the problem, and you should seek credit for solving it. However, their paper, and your interaction with them as an anonymous referee, cannot go unacknowledged. How would you feel if you submitted a paper, a revision was requested on the basis of XYZ issue, and while you are trying to figure out XYZ, you find the next week that a solution to XYZ has suddenly appeared in the literature? 

As for the appropriate resolution, that may depend on field and even journal. I recommend you contact the editor and explain what your situation. A reasonable compromise might be to publish this result in a separate paper collaboratively with the original authors (which obviously requires you to reveal your identity).