greerpalmer:
Welcome back!
Since the 1851 marriage record shows Mary Walsh for the bride then her maiden name was Walsh. It is not common but it does happen where the bride and groom have the same surname particularly where the surname is very common in a particular area.The surname Walsh was not very common in Burriscarra civil parish in the 1855 Griffiths Valuation head of household listing. There were six Walsh records. http://www.failteromhat.com/griffiths/mayo/burriscarra.htm Likely James and Mary were distant cousins but not close enough to need a dispensation from the priest.
There were ten Walsh baptismal records in Burriscarra RC parish from 1849-1869 with parents James Walsh and Mary Walsh so there must have been another couple in the area.
I think there is a very good chance that you have the correct family based on how the names in the 1865 census match up with the baptismal records.
Mary and Mary Anne were interchangeable but I don't see Margaret as an alternate name.
Roger McDonnell