Run a cron job every 5 minutes between two times

You'll have to do it piecewise:

30-59/5 9 * * * script.sh
*/5 10-16 * * * script.sh
0-30/5 17 * * * script.sh

If Ignacio Vazquez-Abrams's answer doesn't really work for you, for example because the script needs a large number of parameters or the invocation criteria are non-trivial (or not time-bound), then an alternative approach is to make a simple wrapper script, call the wrapper script at regular intervals, and have the wrapper script check the current time and invoke the main script.

For example:

#/bin/bash

# Check to see if we should run the script now.
HOUR=$(date +%H)
MINUTE=$(date +%M)
if test $HOUR -lt 9; then exit 0; fi
if test $HOUR -eq 9 -a $MINUTE -lt 30; then exit 0; fi
if test $HOUR -eq 17 -a $MINUTE -gt 30; then exit 0; fi
if test $HOUR -gt 17; then exit 0; fi

# All checks passed; we should run the script now.
exec script.sh ... long list of parameters ...

This allows for encoding execution criteria more complex than cron's syntax readily allows for, at the relatively small expense of invoking a shell and a separate script regularly.