Step 1: Thousand's place condition.
Number lies between $5000$ and $9000$, so thousand's digit can be \[ 5 \] Step 2: Divisibility by $3$.
Sum of digits must be divisible by $3$.
Digits available: $\{0,1,2,5,9\}$
Possible remainders mod $3$: \[ 0:\{0,9\},\; 1:\{1\},\; 2:\{2,5\} \] Step 3: Counting valid combinations.
Total valid combinations for remaining three places satisfying divisibility = $78$.