Regional variations on 三更半夜
Both "三更(gēng)半夜" and "深更(gēng)半夜" are correct. They are listed in most modern Chinese dictionaries. And "半夜三更" and "半夜深更" could also be used as there are no change in the meaning at all, although they may sound peculiar to some people, but they are totally correct to use. (Actually, in Chinese reverse such word constructions are widely used in many case to improve the variety of the text).

However, 三经半夜 is not valid or formal Chinese. 经 cannot be used to substitute 更 both in writing or in pronunciation in formal Chinese. However, it is widely used in speaking but it's widely believed to be a mispronunciation widely adopted. There are many similar cases that average Chinese use pronunciations which is not listed in dictionaries. You could say there is a gap between the speaking system and the writing system of Chinese. But those mismatches are normally minor and most of the time the meaning can be inferred from the context.

About 更

The essential meaning of the character is "Change"

It is also used as a time unit. In ancient China, a day is divided into 12 parts. Each part is called 时, thus it is equal to two hours. According to http://www.guoxue.com/?p=4025 in Han dynasty, there were five shifts during the night in the palace.


一更/头更：戌时　19:00 – 21:00
二更：亥时　21:00 – 23:00
三更：子时　23:00 – 01:00
四更：丑时　01:00 – 03:00
五更：寅时　03:00 – 05:00


So 更 actually means the change of shift originally.

Regarding the difference between 三更 and 深更, from the table above you can see 三更 is actually midnight. 深更 means deep in the night, so basically they are the same thing except 深更 could also be used to refer 四更 or 五更 literally. But when used in 成语 and in combination with 半夜, they don't mean the literal, exact time, they just mean late in the night or midnight in general. In the past, numbers in Chinese are often used figuratively rather than indicating the exact.