It was a much-needed win for the San Francisco Giants, but it came at a great cost. Pablo Sandoval's tie-breaking two-run single in the 16th inning lifted the Giants past the Miami Marlins 6-3 on Thursday, but the Giants also lost third baseman Evan Longoria to a broken left hand after he was hit by a pitch. ''A great win, but a tough loss,'' Giants manager Bruce Bochy said.