One of the wires was an SPI wire that was about 25-30 cm long
Wire or cable?
If you used, say, one wire per SPI signal, but forgot the GND, then the return currents will flow wherever they can, and this can form quite a long loop, possibly with enough inductance to mess with the signal, and certainly creating an EMI problem, as it acts both as a transmitting and receiving loop antenna.
A simple way to do this is to use an IDC ribbon cable, they're quite cheap and, come with practical connectors, and the corresponding headers on your board are easy to handle (ie, not a tiny flat flex that breaks when you look at it wrong).
Now, you can use half the wires in your cable for GND. So you gave GND-Signal-GND-Signal... and each signal has its own very close ground current return conductor, thus crosstalk is low, and signals are clean. You can reduce the number of GND wires (like GND-Signal-Signal-GND) and have more signals in your cable and more crosstalk, until you reach the point of only one GND wire, and it can no longer be called "highspeed".
Twisted pair uses the same principle, enhanced by the fact it is twisted, so the EM fields of incoming noise cancel out.
Note if you have other DC lines (like power supplies) then they count as GND too. Simply place a ceramic decoupling cap near each connector, and the return current for each signal will travel in the nearest wires, GND or power, then use the decoupling cap to return to GND at the connector and into your ground plane.
and was sending a clock of approx 8MHz or so. Now, the communication was failing quite often.
Another issue, and the probable cause of your problems, is that you could have forgotten the series termination resistor on the driving side. Your signal is slow (8MHz) but frequency is irrelevant, it is the risetime that matters.
So, if you use a driver with, say, 2ns risetime, and your cable is 30cm long, this means 2.5ns roundtrip time, then no matter the frequency, there will be transmission line effects on top of the fact that your cable is an undamped LC resonator. Both effects lead to ringing and other artifacts on the fast signal edges, and if it's bad enough to deform the edges of the clock signal into double-edges, then your SPI receiver will double-clock and shift one extra bit, corrupting the transmission.
So, if whatever drives the cable has both fast edges and strong drive current, don't forget the series termination resistor, right at the cable driver.
It can also be a ferrite bead (pick the right one) or any other kind of prepackaged do-it-all ESD/EMI filter but it has to slow the edges as much as you can afford (8MHz will work with 20ns edges), terminate the transmission line and damp the LC resonance of the cable.