The 1877 birth certificate places William John Cochrane in Tyrglassin townland (more commonly Tirglassan). This looks to be his parents in the 1901 census (by which time he was no longer at home, perhaps in Scotland. You could check the 1901 & 1911 censuses):
http://www.census.nationalarchives.ie/pages/1901/Londonderry/Foreglen/Tirglasson/1524963/
1911 census by which time Mary has died (in 1908). They had 6 children of whom 5 were still alive in 1911.
http://www.census.nationalarchives.ie/pages/1911/Londonderry/Fore_Glen/Tirglassan/596084/
https://civilrecords.irishgenealogy.ie/churchrecords/images/deaths_returns/deaths_1908/05508/4543583.pdf
You can see his parents were born in 1841/1839 respectively. That’s well before the start of birth registration in Ireland (1864). So you need to rely on church records prior to that. Both seem to have been Presbyterian and probably attended Banagher Presbyterian (tradition was to marry in the bride’s church so you can be fairly sure that was Mary’s church but it doesn’t follow that the husband also attended the same church. Anyway it’s where I would start). Banagher’s baptism records start in 1834 and there’s a copy in PRONI (the public record office) in Belfast. A personal visit is required to view them.
The 1831 census for Tyrglassin has 4 Cochrane farms (Alexander, John & 2 James). All were Presbyterian and all were likely related.
http://www.census.nationalarchives.ie/pages/1831/Londonderry/Tirkeeran/Banagher/Tyrglassin/21/