The second wife, as well as the son from the first marriage, are both legal heirs as per the personal law of the deceased. So, both have a claim for the benefits.
Since the employee had made the second wife the nominee, you are right in going by the nomination and paying the sum to her. Importantly, the nominee has only the right to receive the amount but cannot entirely appropriate it. The other legal heirs have a claim against the nominee for their rightful share; the employer is not a party to it. Alternatively, the Controlling Authority under the PGA 1972 (the Assistant Commissioner of Labour) is competent to decide who should get what benefit. So, the gratuity amount could be deposited with this authority along with the details of family members.
Since the employee died intestate (i.e., without any nomination), then the PF claims received shall be forwarded to the PF authorities certifying the facts of the matter. Insofar as the other payments like unpaid salary, leave encashment, or any other welfare sum, go by the nomination if it is there. You may consider calling both parties and persuading them to agree to a formula to divide the benefits and advise them against any frivolous litigation, which will only delay the disposal of the matter and entail uncalled-for expenses.