I think you need to do a sequence of matrix
operations and the order of matrix operation
matters.

What you probably want in this case is to first
translate Mercury to position of Sun, then do the
rotation, then reverse the first translation. I
have not yet implemented hierarchical objects
myself so I dont want to confuse you. But here is
the code for my implementation of orbit camera
which the yaw function rotates the camera around a
target point and you may find it useful:

```
yaw: function(radian){
this.q = quat.axisAngle(this.q,
this.GLOBALUP, radian);
vec3.rotateByQuat(this.dir, this.dir,
this.q);
vec3.cross(this.side,this.GLOBALUP,this.dir);
vec3.normalize(this.side,this.side);
this.pos[0] = this.target[0] - this.dir[0]
* this.dist;
this.pos[1] = this.target[1] - this.dir[1]
* this.dist;
this.pos[2] = this.target[2] - this.dir[2]
* this.dist;
}
```

Where this.dir is a normalized vector that
always gives the direction from Camera to target
and this.dist is the distance between camera and
target. You can use matrix rotation instead of
quaternion rotation.

Edit: just to add the direction can be
calculated by taking the difference in position of
the two objects then normalize it.