Well, the solution will be some type of selection.
If the artwork's clean enough, you can use the magic wand tool to select an area that's filled in. So if the white space in the background is all one area contained in black outlines, you should be able to select that.
The longer way will be using one of the selection tools to draw the area you want to fill in around the foreground objects and just do the gradient inside of that.
Hope that helps.