Here's one approach...
1. Prepare a mask/alpha channel that separates the background (including shadow) from the object.
2. Create new layer on top of the background layer. Fill this with your gradient as desired. Set blend mode to "Multiply".
3. Add a layer mask to the multiply layer created in step 2 based on the mask/alpha channel you created in step 1, so that the gradient is not visible over the object itself but is visible over the background (and shadow).
Example is attached. You need to be careful with your masking around the edges (although you can touch up later on the layer mask).
Very good advice on creating masks of objects (as well as very good advice on other things) is to be found in
Photoshop Channel Chops by David Biedny, Nathan Moody, and Bert Monroy. Or at least, it is to be found there if you know where your copy is and haven't mysteriously mislaid it (speaking purely hypothetically here, of course).