Wilde in talks to replace Garner in ‘Chemistry’

'Cowboys and Aliens' thesp steps in for her pregnant 'Butter' co-star

“Cowboys & Aliens” star Olivia Wilde is set to replace Jennifer Garner in Occupant Films’ darkly comedic thriller “Better Living Through Chemistry.”

Indie pic was originally slated to star Garner before she recently became pregnant with her third child.

In July, Sam Rockwell signed on to play a meek, small-town pharmacist stuck in a loveless marriage who rediscovers himself by starting an affair with a trophy wife, who will now be played by his “Cowboys” co-star Wilde.

After she introduces him to the pleasures of prescription drugs, things spin out of control when they begin plotting to kill her husband.

Michelle Monaghan is set to co-star as Rockwell’s wife, while Judi Dench is expected to serve as the film’s narrator.

Geoff Moore and David Posamentier, whose script appeared on the most recent Black List, will make their directorial debut.

Occupant’s Joe Neurauter, Felipe Marino and Keith Calder are producing “Chemistry,” for which ICM is handling North American rights. Ealing Metro is handling international sales for the pic, which is slated to start production this fall in Maryland.

Wilde also recently starred in David Dobkin’s “The Change Up.” She’ll soon be seen alongside Garner in The Weinstein Company’s “Butter,” which will debut at the Toronto International Film Festival.

Wilde has an additional quartet of films on the horizon, including Andrew Niccol’s “In Time” and Alex Kurtzman’s “Welcome to People.” Thesp recently exec produced the short documentary “Sun City Picture House,” which follows a Haitian community struggling to rebuild after the devastating 2010 earthquake. Pic won the Maui Film Festival’s audience award.

Wilde is repped by WME and Untitled Entertainment.