A Hindu community at risk of losing its temple has won the first round of a legal fight against the local authority.