The directories in PATH are simply checked in the order that they appear. If /usr/local/bin comes before /usr/bin, and a program with that name exists there, then that's the one it will use. However, simply changing the PATH order might affect other programs too, so alter it only if you're absolutely sure you won't break anything. You should consider possible future needs too, of course.
Your best option therefore, if possible, would be to move/rename/recompile the 2.7 version so that it doesn't appear in that directory, or otherwise doesn't conflict in name with the 2.4 executable. Moving it to its own subdirectory inside /usr/local/bin would work, for example.
Another possibility would be to set an alias or shell function to override the path search, but you'd still have to hard-code the location in scripts.
The default path is most likely set in your /etc/bashrc, of course, or one of your other shell startup scripts.