First things first: if you're talking about a production system and you're not the sysadmin (your comment indicates you aren't), don't touch the system.
If you elect to ignore that advice and inadvertently break things your sysadmin will probably cause you serious bodily harm upon his return (and will be entirely justified in doing so -- Nothing is worse than coming back from vacation to find someone has broken things by trying to "help", except maybe getting an emergency call while you're on vacation).
All that said, if you want to do this manually you must determine exactly what is being installed by the
php5-pgsql package (in addition to PHP compiled with Postgres support it also includes the pgsql PDO extension, and possibly other stuff). Then you need to manually install all of the pieces.
There is no guarantee that you will be able to assemble this puzzle: For example, PECL (where you'd get the PDO extension) is only tested on supported versions of PHP. It will probably work, but if it doesn't the solution is "Upgrade PHP to a supported release".
To echo what other people have said in their comments:
Locking your system to a specific version of PHP is Bad.
If you have a system that requires PHP 5.2 (long since unsupported, and riddled with known security holes) it's time to sit down with your sysadmin and write a memo to the 2 levels of management above you. (If your sysadmin doesn't see why this is a problem you write the memo and CC him.)
Locking your system to a specific patch level of PHP is Insane.
If you have a system that absolutely requires PHP 5.2.4 you should have already written a memo about it, and screamed at everyone in person about how it's unsustainable and will create major problems in the future.
If you had written that memo this is where you get to look prescient and say "Remember that memo?" -- Otherwise you get to write it now (which doesn't look as good, but at least shows you're doing your job and pointing out serious risks to the business).