Updating an object's position

I am working on a game and I am getting this issue with my game object’s position. What I have is a game object (space ship) and I used the Animation Window to set up two animations (idle and slightly rotating forward).

My situation is that I have the ship moving forward, but when I release the button instead of the ship stopping where it should, it goes back to where it first started. Can anyone help me figure out what I am doing wrong?

Here is my code:

enum ShipStates { idle, forward, left, right }
    ShipStates CurrentState = ShipStates.idle;

    Vector3 PreviousPosition, 
            CurrentPosition;
    void Start()
    {
        PreviousPosition = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
    }
	// Update is called once per frame
	void Update () 
    {
        switch (CurrentState)
        {
            case ShipStates.idle:
                animation.Play("Idle");
                PreviousPosition = CurrentPosition;
                break;
            case ShipStates.forward:
                animation.Play("Forward");
                gameObject.transform.Translate(Vector3.forward * Time.deltaTime);
                CurrentPosition = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
                break;
            case ShipStates.left:
                break;
            case ShipStates.right:
                break;
        }
	}

And many thanks in advance!

When your ship moves to the forward state, you set CurrentPosition and play the forward animation each Update. When your ship enters idle state, you set the previous position to the current position. I don’t see any reason for you to store the current position or the previous position. My hunch is that the “Idle” animation itself is what is resetting your ships position back to start. Test this in the animation window (in scene view): move your ship around, then play the idle animation, does the ship move when you play idle.