While it is true that Ocelot did not just act but also had the help of psychotherapy, hypnosis and nanomachines in order to behave in line with Liquid's persona, he preserved his inner conciousness. In fact, the official guide states it clearly:
<< Ultimately, the story of Metal Gear Solid 4 is the conclusion of a vast conspiracy through which Ocelot and EVA (with Naomi's help) exact their revenge on Major Zero, and open the doors of redemption for themselves. We should be under no illusions as to the true role of Ocelot from the very start. As Big Boss reveals, "In order to fool the system, Ocelot used nanomachines and psychotherapy to transplant Liquid's personality into his own mind. He used hypnotic suggestion to turn himself into a mental doppelganger of Liquid." Foreseeing every step that Snake would make, every likely outcome, Ocelot allows his apparent adversary to complete the most integral parts of his plot because he understands, fundamentally, that Snake is the tool of The Patriots and therefore above suspicion in their eyes -- whether he knows it or not. [.....]
Ocelot knows that the only way to bring down the Patriots is to infect the central AI, JD, with a virus. However, there are prequisites that must be met for his plan to work: one, that the virus code must be of a sufficiently high standard, and two, that he gave access to a system protected by an unprecendented degree of security.
[.....]
As for how to deliver the virus into the heart of the Patriots' AI system, Ocelot knew that the only way to break through its security was to use a unique key: the genetic code and biometric data of Big Boss.[...]
The rest of the story is a series of deceptions designed to drive Snake ever onwards, and allay the suspicions of the Patriot AI systems. Ocelot, despite the presence of Liquid Snake within his consciousness, has no intention of using the rail gun retrieved from Metal Gear REX. Neither does he truly plan to become leader of the Patriots himself, despite his assertions to the contrary. Ocelot simply wishes for an end to The Patriots' control system, and leads Snake, their trusted yet unknowing tool, to become the agent of their ruin. For greater verisimilitude, at no point does Snake enjoy an easy ride: the sheer felocity of the forces ranged against him (soldiers, the Gekkos, the BB Corps, Vamp) underlines the apparent sincerity of Liquid Ocelot's desire to allay the legendary soldier. And yet Ocelot, significantly, fails to dispatch Snake when given several opportunities to do so, in a manner that clearly surpasses the traditional cliche of villainous arrogance.
Ocelot, then, is not a nefarious figure, a tyrant seeking endless power, but the mastermind behind a plan to break the authoritarian rule web that the Patriots were weaving over the world. From this perspective, Ocelot (even in his guise as the pitiless Liquid Ocelot) is as much a hero as Snake. Even his vicious rout of the forces brought by Meryl to capture him in Eastern Europe bears further examination. At the very moment that he froze military hardware throughout the world with an apparent nonchalant wave of his hand, didn't Ocelot effectively end all ongoing conflicts at once, becoming the main architect of peace and the man to end the war economy? Despite their mutual antagonism from the first time they met, Snake and Ocelot actually worked together to stop The Patriots' rule.
Only once the virus has been deployed does Ocelot reveal hints of his true self. There is an almost cathartic quality to the brutal unarmed combat that ensues between the two before Ocelot's life is extinguished by the FOXDIE that courses through Snake's veins. Ocelot's valediction confirms that he actually played Liquid's role all along: "I am Liquid's doppelganger."
[.....]
Some, like EVA, Ocelot, Naomi and Big Boss (who deliberately breathes the FOXDIE virus exhaled by Snake) find redemption in death, both their own and in that of The Patriots' corrupted ideals. Others, such as Otacon, Meryl and Campbell, find redemption in life through their atonement for past mistakes. As for Snake, he finds himself poised between life and death, trapped between the past and the future, between Snake and David. There is, perhaps, a hint of a future, for the tired soldiers before the end credits roll. With the knowledge that the new FOXDIE virus has supplanted the one before it, Big Boss encourages Snake to start over, to embrace a new (albeit short) life as a fresh aura dawns. >>
The guide also clarifies the confusion on why EVA and Ocelot act as enemies in Act 3:
<< EVA died believing that Liquid Ocelot truly existed, as convinced as any other that her friend had become merely a vessel for Liquid's malign spirit. This was the true extent of the price that Ocelot had to pay in order to succeed: not even EVA could know the true scope of his plan. >>
As to why Ocelot attacked Snake with the ship, wouldn't it be unnatural to command a giant ship, have your enemy right in front of you and just... leave? Ocelot knew that Raiden would come to Snake's rescue and used this to seem to try to kill Snake.