Who should handle an emergency when there's both a certificated pilot and a CFI on board?
From a safety perspective both pilots should be handling any emergency that arises, each working to their individual strengths and expertise to ensure a safe outcome.
This is exactly what you did in the scenario you describe.

In terms of who calls the shots (acts as PIC for the emergency), generally the most qualified pilot onboard should be the one giving the orders. Deciding who that is falls to the pilots onboard (because they're the ones who will arrive at the scene of any resulting accident first).



So in my mind the question really is "How do I determine who is most qualified?" -- Any opinion we can give here comes dangerously close to second-guessing your emergency actions which is something I personally try to avoid, but I'm going to embellish your scenario above for illustrative purposes:


The Instructor
Former air force pilot ATP, CFI/CFII, MEI.
10,000 hours in various jets, 10 hours in an Arrow (doing this instructing gig.) and for the sake of argument no other time in PA-28s.  
You
PPL + Instrument Rating, working on your Commercial.
300 hours, 200 in fixed-gear PA-28s and let's say 20 in Arrows.


I'll further assume you both kept your cool and didn't panic (because if either of you turned into a quivering blob that would automatically disqualify them from taking control of the aircraft).

If we go by the certificates, your instructor is certainly "more qualified" - and in 10,000 hours they've probably dealt with more real-world emergencies than you have.  

If we go by "time in type" and experience flying PA-28 variants you're clearly more familiar with the general type, and possibly this specific aircraft &amp; systems (like the emergency gear extension system).

Given the above, having you handle the controls seems to be the most logical course of action. The CFI can do "everything else" - communication, traffic scan, calling out checklists &amp; altitudes, etc. - to ensure that you can concentrate on flying the plane and landing as safely as possible.