Yeah, unfortunately the only way the rules cover small creatures being on top of and occupying the same space as medium creatures is if they are riding them, and they need to be an appropriate mount in order to ride them, so unless your tiefling is wildshaped into say a boar the rules don't actually cover this kind of situation. Mounting a medium mount would definitely allow the goblin to attack a creature 10 feet off the ground RAW, but you can't mount humanoids RAW although it would be a perfectly acceptable use of a house rule to make it a fairly easy (DC 10ish) ride check (or better yet an acrobatics check as Skeld suggested)to stay on your ally's shoulders while you were both engaged in combat.
I've actually been wondering this lately, and if it would be acceptable to have a sentient bipedal creature as a mount, mostly cause I think it would be funny for a gnome or halfling to have a human as a mount. I don't think I've ever found something that says you can't ride a sentient creature, only that you take a -5 to ride checks with creatures ill suited to riding.
As for actually using the ride skill, I don't see why you couldn't, although you'd be at a -10 to any ride skills, although the only thing you really need to roll for should be the stay in saddle, or cover checks, since you can just ask a sentient being to do things instead of steering them.
Acrobatics could work too, although I don't know what you'd use for your check though, maybe going off the narrow surface list. But do you make the check once, once every round, every time you take damage. At least with ride it's kind of already spelled out for you, even if it is a little ridiculous.
Ride seems iffy, unless for some reason the goblin has experienced 'riding' medium bipeds.
Acrobatics has potential... I think what I would do, is an acrobatics in order to keep your balance and make the attack, Then probably just use the squeezing rules for having two people in one square. Admittedly this is vertical instead of horizontal... but RAW doesn't make that distinction :P
That should give some appropriate penalties, without having to reinvent any wheels...