 He competed on Team USA for the 2009 World Baseball Classic after an injury to BJ Ryan.On June 30, 2009 the Nationals traded Hanrahan and Lastings Milledge to the Pittsburgh Pirates for Nyjer Morgan and Sean Burnett.On July 9, 2009, Hanrahan earned a win for the Nationals while on the Pirates roster when Washington beat the Houston Astros in the bottom of the 11th inning in the completion of a game from May 5 because he was the pitcher of record, recording the final out for the Nats in the top of the 11th.