Creatures can get stuck in trees both as they mature (hoisted into the air) or expand (climber among branches suddenly finds there's no longer a path back). On a hillside the gobbo might have climbed or fallen. In neither of these cases are the target reachable by melee fighters (they usually don't climb to reach targets, except for crossbow dwarves out of ammo, who have an incredible ability to find and use any normally inaccessible path to suicide charge enemies swinging the crossbow as a club).
I can see a few different ways to deal with the bugger:
- Send a crossbow squad. They may or may not be able to fire back (I don't use xbows because of their problems, including failure to fire back at gobbos on the ground while standing on the roof of my 3 tile high courtyard).
- Build a high structure (at least 10 tiles above the gobbo) with a foot far enough away not to be scared by the gobbo during construction and then dump stuff on it.
- If it's in a tree, build a ballista 20 tiles away from the tree at the same level as some part of the tree and fire at it. That should hit the tree and disintegrate it (bonus points if the gobbo is hit), after which your melee fighter should be able to rush it and finish it off. Note that you may need a number of shots to actually hit the target.
- If it's on a hill, pour magma down the hill to burn it to a crisp. That's easiest done via mine cart hauling. You can also use the same technique with water in the hope of flushing it down the hill. For this use I'd rather use screw pumps and larger volumes of water.
- If it's on a hill, designate a dump zone at the edge of the top of the hill and designate stones for dumping. The stones should roll of the edge and hopefully hit the gobbo to push it down the hill (and don't station your militia directly downhill in the roll path...).