The maths are not too bad for circular orbits, much nastier for elliptical orbits. Here's what I'm getting.
where
is the radius of the orbit,
is a constant, m is the mass of the comet, and
is the time of one orbit.
So how big is this thing? If it is one millionth the size of the earth (I'm guessing it's much smaller than that?) then you can maintain the same time of orbit by reducing the radius of the orbit by 100 times. So that would viable - if it is the same density and same shape as earth, then it would have one millionth the mass by having a radius 100 times smaller, so you could orbit 100 times closer.
Well that's interesting - if something is round and as dense as earth, the fastest possible orbit (by whipping around just above the surface) always takes the same time, regardless of how big the thing is? Can that be right? So you could put something into orbit around a piece of rock the size/shape of an association football, it would take maybe an hour or two to go around? (This strikes me as so bizarre, I'd really like someone to double-check my analysis!)
You could also maintain the same radius of orbit by taking 1000 times longer to go around.
This is probably pretty robust to the presence of other objects - even if the gravity from the sun is strong (and it's strong enough that the comet is in orbit around the sun), it won't mess up the orbit around the comet, if that orbit is small - then the sun's gravity when the craft is behind the comet is almost exactly the same strength as when it is in front of the comet, so the craft will happily orbit the comet, while both orbit the sun together. (Witness the moon, in a nearly circular orbit around the earth, even though the earth/moon together are orbiting the sun.)
So I guess you could orbit just about anything, as long as it's dense. If it's just a big cloud of dust, then you have a problem, because to get close enough to have a reasonable orbit, you'll be inside it.