The window to remove the Lannisters was the small one when Stannis, Renly and Robb all just declared and were still alive.
No one realized Stannis' hatred for Renly, Renly's puffed up self importance from Loras and Robb never really made it to the table and Stannis was too unbending to really manage much compromise anyways. So... it was really impossible or at least amazingly unlikely to work out due to the nature of the players involved.
Eddard really needed to step up and do something clever and get Stannis moving into position before Robert even died, but thinking people would respect the writ from the king he had, was too slow and everything went to shit.
Oh, and I recall Catelyn, in the show at least, trying to get Eddard to stay in Winterfell and not go to King's Landing.