Join parts of the SAME mesh

http://img27.imageshack.us/img27/953/fppc.th.jpg
Is there a way to: join two those cubes into one object (without separating one of cubes into a mesh and then applying Union) and automatically deleting the inner vertex from this mesh (Union does this, but in fact model that I am working on has hundreds of such objects, so doing this manually will take hours). Is there a simpler way? Any links, tutorials?

Edit: separating ALL loose parts (as in http://blenderartists.org/forum/showthread.php?t=167820) and then Union-ing them alltogether works on the example above, but on real model Blender just crashes with exception 0xc000000d.

You could use the knife tool, and cut edges where the cubes intersect.
Then merge with ALT-M

an automatic process is going to be difficult to find. if a manual process won’t work, it may have to be boolean union. trouble is union will only join the last two objects selected. also, the meshes must be clean, ie no doubled verts/edges/faces and normals must be pointing outwards