Spock, master of spin
Spock put a convincing "spin" on his plan when he explained it to Kirk, playing down the margin of error. Just as Scotty learned to pad his estimates when Kirk was likely to make unreasonable demands, Spock knew that Kirk had trouble relying on logic for making dispassionate decisions in scary situations.
Based on the Star Trek IV transcript, Spock determined the earliest date from which they could return. He listed fuel components as a limiting resource:
KIRK: What is our target in time?
SPOCK: Late twentieth century.
KIRK: Surely you can be more specific.
SPOCK: Not with this equipment. I have had to programme some of the
variables from memory.
KIRK: What are some of the variables?
SPOCK: Availability of fuel components, mass of the vessel through a
time continuum, and the probable location of humpback whales, in this
case, the Pacific basin.
A trip deeper into the past would have presumably required a more extreme slingshot maneuver with greater strain on fuel components.
As it turned out, they arrived right on target, so Spock's computations were accurate. Spock's plan broke the ship, but he had a way to fix it:
SCOTT: Admiral, we have a serious problem. Would you please come down?
It's these Klingon crystals, Admiral. The time-travel drained them.
They're giving out. De-crystallising.
KIRK: Give me a round figure, Mister Scott.
SCOTT: Oh, twenty-four hours, give or take, staying cloaked. After
that, Admiral, we're visible, ...and dead in the water. In any case,
we won't have enough to break out of Earth's gravity, to say nothing
of getting back home.
KIRK: I can't believe we've come this far only to be stopped by this!
Is there no way to re-crystallise dilithium?
SCOTT: Sorry, sir. We can't even do that in the twenty-third century.
SPOCK: Admiral, there may be a twentieth century possibility.
KIRK: Explain.
SPOCK: If memory serves, there was a dubious flirtation with nuclear
fission reactors resulting in toxic side effects. By the beginning of
the fusion era, these reactors had been replaced, but at this time, we
may be able to find some.
KIRK: I thought you said they were toxic.
SPOCK: We could construct a device to collect their high-energy
photons safely. These photons could then be injected into the
dilithium chamber, causing crystalline restructure. ...Theoretically.
KIRK: Where would we find these reactors, ...theoretically?
SPOCK: Nuclear power was widely used in naval vessels.
The way Spock immediately offered a solution to their crystal dilemma (the aforementioned "fuel components", it seems), a suspicious person might think that this was part of his original plan.
(I'm tempted to think that Spock simply remembered reading about the Cetacean Institute's humpback whales, couldn't quite recall all of the details due to post-regeneration trauma, and based the entire plan around a hunch.)