A "donk" or a donkey is a slang term for an engine, so thrashing the donkey would mean that they were running at high power to get the extra speed.
See also:
"Pouring on the coals"
"Opening the taps"
"Givin' it some stick"
"Givin' it some beans." etc.etc...