O'Leary was born in Chicago, Illinois. He has two older half-sisters and an older half-brother. O'Leary auditioned for the lead in Home Alone 3. He made his acting debut in the lead role of the 2000 made-for-television film Mom's Got a Date with a Vampire. He was subsequently cast in the thriller Domestic Disturbance, playing the son of John Travolta's character; the film was released in November 2001 and performed fairly at the box office, grossing $45 million.
O'Leary next appeared in another thriller, Frailty, directed by Bill Paxton, and in the kids comedy Spy Kids 2: The Island of Lost Dreams, both of which opened in 2002 to positive reviews, gaining O'Leary recognition among teenage audiences. In 2003, O'Leary had a minor role in the final Spy Kids film, Spy Kids 3-D: Game Over, and also appeared in the 2004 drama The Alamo, although most of his role was reduced to one line.
In 2005, O'Leary had a role in Warm Springs, a television film, and Havoc, a drama starring Anne Hathaway that was released directly to video. O'Leary came into mainstream prominence in the later half of the 2000s for his roles in Brick, a quirky thriller starring Joseph Gordon-Levitt, and the 2007 films Live Free or Die Hard and Death Sentence. His most recent starring performance was as Garret in the remake of Sorority Row.