William F. Weld , the former Massachusetts governor , suffered a major rebuke from his own party on Thursday when he lost his bid to win Republicans ' backing in the race for governor of New York , though he still won enough support to remain on the Sept. 12 primary ballot .