By Wendy Thurm

A funny thing happened on the way to a story about the San Francisco Giants owning the best record in baseball. After losing eight of their last nine, they no longer do.

The Colorado Rockies swept a three-game series at AT&T Park last weekend. In all three games, the Giants had the lead heading into the late innings, where San Francisco's bullpen had previously dominated. Erratic defense and less than stellar pitching led to three rip-your-heart-out losses. The weekend sweep followed a tightly contested four-game series against the Nationals, in which the Giants managed only one win.

Then, the Giants headed to Chicago for a two-game interleague series with the White Sox, who themselves had lost four of five. No matter. Starters Matt Cain and Tim Hudson were shellacked -- an all too familiar result for Cain this season, but a big surprise for Hudson, who entered the game with the lowest ERA in the National League at 1.81.

Now the Oakland A's -- the Giants cross-bay rivals -- have the best record in baseball at 44-29. The A's also lead the majors with a whopping +132 run differential. Somehow -- somehow -- the Giants still lead the National League in run differential at 47, but that's no solace for a team that's seen it's 9 ½ game lead in the National League West shrink to four games in a little more than a week.  

Given their recent slide, it's fair to ask: How did the Giants build the best record in baseball through the first week in June?

The answer is simple: Until the last week, they've were very, very good when it counted.

We can chart the Giants' success in these situations using several advanced metrics: Win Probability Added, Leverage Index and Clutch, all of which are calculated and available on FanGraphs. WPA measures how a player affects his team's Win Expectancy on a play-by-play basis. Win Expectancy is the percent chance a team will win based on score, inning, outs, runners on base and the run environment. Leverage Index measures how important a particular situation is in a game, factoring in the inning, score, outs and number of players on base. Clutch measures how well a player preformed when the Leverage Index was highest -- i.e., in the later innings, with the score tied or close and runners on base -- compared to how he performed in all leverage situations.

Through Tuesday's games, Giants hitters had amassed a collective 6.57 WPA and 2.68 Clutch, both of which rank highest in the National League. Giants pitchers haven't been quite as effective under pressure, particularly the starters, who've produced a -1.59 WPA, but the bullpen has been solid. Giants relievers have a collective 2.48 WPA, good for third best in the National League.

WPA and Clutch are not predictive statistics. They tell us only what has already happened on the field. Just because the Giants have been very good in high-leverage situations so far does not mean they'll continue that pace for the rest of the season. They may; they may not.

On offense, the Giants can point to their overall numbers as evidence their early season success at the plate hasn't been the product of solely of luck, magic or the elusive "team chemistry." San Francisco had the fourth-most effective offense in the National League through Tuesday's action, as measured by weighted runs created-plus. Another FanGraphs stat, wRC+ measures how many more runs a player is producing than the average player in his league, as adjusted for different ballparks. A 125 wRC+ means a player is producing 25 percent more runs than the average hitter in his league. As a team, the Giants have produced 103 wRC+, behind the Dodgers (108), Rockies (106) and Pirates (105). No other team in the National League has a wRC+ above 100.

Still, the Giants seem to rest on their laurels when they get a lead, instead of piling on and putting a game out of reach. Through Wednesday's games, San Francisco had 1,068 plate appearances when batting with a lead and produced a line of only .215/.273/.331. As effective as they've been in high-leverage spots, they've been ineffective when the pressure appears to be off.

The offensive standout for the Giants has been newcomer Michael Morse. The right-handed power hitter was coming off two injury-riddled seasons and the Giants scooped him up on a one-year/$6 million contract. Morse was expected to play left field, and he did, until first baseman Brandon Belt went on the disabled list in early May with a broken left thumb. That shifted Morse to first and led to a carousel in left field among Gregor Blanco, Tyler Colvin and Juan Perez. The position doesn't appear to have affected Morse's hitting: He's posted a 149 wRC+ to date, good for 10th best in the National League, although he's cooled off in June.

But the beauty of the Giants' offense is how well-balanced it has been. Morse and centerfielder Angel Pagan were scorching hot in April, when third baseman Pablo Sandoval couldn't buy a hit. Rightfielder Hunter Pence turned it up in May, just as Sandoval was coming out of his slump, and that covered for a struggling Buster Posey, the 2012 National League MVP. June's offensive heroes have been shortstop Brandon Crawford (whom I profiled a few weeks ago), Pence and Posey.  

There are holes in the offense, particularly at second base. The expected starter, 2012 postseason hero Marco Scutaro, hasn't played an inning this year as he works to overcome back and hip injuries. Brandon Hicks -- who had 98 major-league plate appearances entering this season -- has played the vast majority of games at the keystone. Hicks' bat was a revelation in April, when he hit five home runs and posted a 140 wRC+. But he's been in a freefall offensively ever since. For the season, his batting line is .172/.289/.339. The infielders on the bench provide no reprieve. Ehire Adrianza's posted a 33 wRC+, which looks positively energetic compared to Joaquin Arias' 6 wRC+.

And now Pagan -- who fueled the Giants' offense with a .365 on-base average in April and May -- is dealing with back issues that have kept him out of the lineup since Saturday. When Pagan suffered a torn hamstring last May, the Giants' offense fell into disarray. The addition of Morse, and with Belt returning soon, means the Giants should be able to withstand a Pagan injury better than last season, but right now, it's a big unknown.

There are a lot of unknowns with the Giants, actually, particularly with the starting rotation.

The good news first. Madison Bumgarner and Tim Hudson have pitched well, notwithstanding Hudson's clunker against the White Sox on Wednesday. Bumgarner is 8-4 with a 2.85 ERA and the third-highest strikeout-to-walk ratio in the National League, at 20.6 percent. Hudson is 7-3 with a 2.39 ERA. He's issued only 14 walks in 94 innings pitched, for a 1.34 BB/9, the second-lowest in the National League. In their combined 29 starts, Bumgarner and Hudson have given the Giants 19 "quality starts," meaning at least six innings pitched while allowing three runs or fewer. They may stumble from time to time, as Hudson did Wednesday, but they are a solid one-two punch.

At the back end of the rotation, Tim Lincecum and Ryan Vogelsong are holding steady. Both got off to rocky starts in April, but pitched effectively in May, and were a big reason the Giants sped out to a large division lead. The Giants are 18-10 in games started by the two.

But their success is tenuous. Lincecum is nowhere near the pitcher he was when he won the National League Cy Young Award in 2008 and 2009, but when he can command his fastball and throw it at least 90 mph, his offspeed pitches become that much more effective. The problem is, some days, he simply cannot command his fastball. Vogelsong, too, relies on command, painting the corners of the strike zone with a mix of fastballs, sliders, change ups and curves. When he doesn't get the calls, and he's forced to throw the ball more in zone, good hitters can square him up.

This brings us to Matt Cain. The Giants drafted the right-hander out of high school and he's been a fixture in their rotation since 2007. Cain was long overshadowed by Lincecum, but he came into his own in 2012, when he pitched the 27th perfect game in major league history and spearheaded a rotation that delivered the second World Series Championship to San Francisco in three years.

Cain had a down year in 2013, largely because he gave up a career high in home runs (23). His strikeouts and walks were consistent with his career numbers, but his results were not. So far this season, Cain's strikeouts are down his walks are way up, and his propensity for giving up the home run has only gotten worse. He's had two short stints on the disabled list -- one for a finger cut he suffered slicing a sandwich in the clubhouse and another for a hamstring strain -- but it's difficult to know if either or both of those injuries has affected his mechanics or his stuff.

Either way, Cain's given the Giants just three quality starts, and the team is only 4-7 in his 11 starts. It's a tough place to be for Cain. It may be tougher for the Giants. Cain is in the second year of a five-year/$112 million contract extension. The Giants may very well need to strengthen the rotation before the July 31 trade deadline, and they've been linked to the Cubs' Jeff Samardzija. Yet, it's hard to imagine the team demoting Cain to the bullpen. Perhaps San Francisco is considering a six-man rotation or a hybrid model where they occasionally skip a Cain, Lincecum or Vogelsong start depending on how each is throwing.

If the Giants do tinker with the rotation, it will undoubtedly affect the bullpen, which has done solid work. Yes, Sergio Romo blew two save opportunities against the Rockies last weekend, and J.C. Gutierrez coughed up a lead in Sunday's finale against Colorado. Even so, the bullpen as a whole has kept hitters to a .214 batting average and a 7.3 percent walk rate, the lowest in the National League. The relievers' collective 2.80 ERA trails only the Nationals (2.54) and the Padres (2.62).

Unless the past 10 days reflect the Giants true talent -- and not even the most ardent Dodgers fan would say it does -- San Francisco is still in very good position to win the National League West or, at the very least, one of the wild-card spots. Using the Giants' record to date, together with player projections for the rest of the season, FanGraphs sees the Giants ending with 90 wins and the West title. Baseball Prospectus is even more sanguine on the Giants, with a projected win total of 91, ahead of the second-place Dodgers.

But the Giants have work to do, on and off the field. They need to get healthy, stabilize the rotation and play like they did in April and May. If not, come October, we'll be talking about an epic collapse.

* * *

Wendy Thurm is a contributing writer at FanGraphs and Bay Area Sports Guy. She has also written for ESPN.com, SBNation, The Score, and the Wall Street Journal. You can follow her on Twitter@hangingsliders.