Diskutil has a mergePartitions command. It has caveats: only partitions that are sequential on disk can be merged, and only the data from the first partitions will be preserved, and only if it's a partitions formatted as journaled HFS+. in terminal, you would type:
diskutil mergePartitions firstPartition lastPartition
where first and last partitions can be specified bu mount points, disk identifiers, UUIDs, or device paths. see man diskutil for details.
Be careful. the command diskutil mergePartitions disk1s1 disk1s3 will merge partition 1, 2 and 3, not just 1 and 3. This is particularly tricky if you use mount points: diskutil mergePartitions /volumes/gumby /volumes/foxtrot may erase other partitions accidentally or may do nothing at all if you are not sure of the partition order on disk. Run the command diskutil list in terminal to make sure you have your specifiers and formats correct before you try merging.