Rotate around, but track the mouse

This is a 2d side scroll setup. I'm trying to have an object (lets just say its a gun or something) rotate around the player but still track the mouses movement. I honestly don't know where to start for this one as rotation stuff just doesn't click well for me. Anyone have an idea to solve this?

this should work..... attach this script to the gun :)

function Update () {

var position = Input.mousePosition;
    newposition = Vector3(position.x,position.y,-camera.main.transform.position.z);
    var lastposition = camera.main.ScreenToWorldPoint(newposition);
    transform.LookAt(lastposition);
}