Mazda 3 and Focus share some parts (some engines, chassis platform) but there are some important points about that.
The questions should be how much of Ford is actually a Mazda:-)
1. Chassis was developed by Volvo, suspension by Mazda.
2. Engines in question were actually developed by Mazda as MZR engines and are used by Ford since 2004 branded as Duratec.
It's important to realize that a engine is just a raw component and every company tweaks it to suit their own needs (it's like in motorsport where you have several teams using the same engine but sometimes they miles apart on the track).
Then there's thing how manufacturer utilizes an engine in a car and how it works with other components.
That gives the edge to Mazda by a landslide. If you look at TUV (German industrial Technical Monitoring Association) reliability report, the most reliable car in Europe is Mazda 3.
http://news.auto.cz/aktuality/auto-bild-tv-report-2008-vozy-stari-2-3-roky-lidove-mazdy-momentalne-vladnou.html
It's in Czech (I can't speak German to find it on the web) but if you scroll down you'll find a table based on percentage of cars with serious flaw. It's just numbers and cars' names.
TUV reports are highly reliable and respected. TUV is an independent body and data are gathered from more than 7 million vehicles in Germany. The minimum for each model is 10,000 cars.
As for electrics...
Electrical systems in my Mazda 3 (2007, 1.6 liter auto) were made by Mitsubishi... apparently, they work better with Japanese parts:-)
I know for sure that Ford wirings were partially made in Slovakia in the past in a plant belonging to Siemens subsidiary (factory in my native town). I don't think Focus and 3 share any electronics, from what I know Mazda is using their own ECU (electronics control unit)
Last but not leas... Focus is made in Mexico and USA, European models in Spain and Germany.
Mazda 3 is "Made in Japan". And that means a lot.
Mazda 3 has 8 airbags, ABS is standard, mid-level trims have DSC and TCS as standard... I had mine for a year now and I'm absolutely satisfied.
On more personal level, I found Mazda's driver's ergonomics superior to Focus. The layout of controls is much better, for example, the 2007 Focus I test-drove for my friend (Mazda 3 was out of her budget and Ford had some Christmas sale going on) had CD player controls not on the steering wheel but on the steering column, so I had to take my left hand off the wheel anyway to turn the volume up or down. Also, Mazda headlamps and lights are operated via indicator bar, in Ford you have to reach for bottom left corner of the dashboard. And the glovebox on Mazda was bigger :-)))
Hope that helps.