I think most 7850s would fit since they are not that long and HP cases aren't tiny either. It would however be wiser to get some measurements done before you buy the card and also make sure your PSU is good enough because most HP PCs come with crappy PSUs.
It should work. If not i would get a dremmel and saw away some of the hard drive cadges. Or if there are screws to take them out do that. Or you could also upgrade your case to a mid or a full tower i honestly have no expirience with HP computers